summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest
diff options
context:
space:
mode:
Diffstat (limited to 'dom/tests/mochitest')
-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.html15
-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.js463
-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/offline/445544.cacheManifest8
-rw-r--r--dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/445544_part1.html9
-rw-r--r--dom/tests/mochitest/ajax/offline/445544_part2.html9
-rw-r--r--dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html9
-rw-r--r--dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html37
-rw-r--r--dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html25
-rw-r--r--dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest37
-rw-r--r--dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/744719.cacheManifest36
-rw-r--r--dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest3
-rw-r--r--dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/bypass.cacheManifest7
-rw-r--r--dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/bypass.html41
-rw-r--r--dom/tests/mochitest/ajax/offline/changing1Hour.sjs8
-rw-r--r--dom/tests/mochitest/ajax/offline/changing1Sec.sjs9
-rw-r--r--dom/tests/mochitest/ajax/offline/changingManifest.sjs27
-rw-r--r--dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs27
-rw-r--r--dom/tests/mochitest/ajax/offline/explicitRedirect.sjs27
-rw-r--r--dom/tests/mochitest/ajax/offline/fallback.cacheManifest11
-rw-r--r--dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/fallback.html12
-rw-r--r--dom/tests/mochitest/ajax/offline/fallback2.html12
-rw-r--r--dom/tests/mochitest/ajax/offline/fallbackTop.html8
-rw-r--r--dom/tests/mochitest/ajax/offline/foreign1.cacheManifest3
-rw-r--r--dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/foreign2.cacheManifest3
-rw-r--r--dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/foreign2.html69
-rw-r--r--dom/tests/mochitest/ajax/offline/jupiter.jpgbin0 -> 30694 bytes
-rw-r--r--dom/tests/mochitest/ajax/offline/manifestRedirect.sjs6
-rw-r--r--dom/tests/mochitest/ajax/offline/missing.html24
-rw-r--r--dom/tests/mochitest/ajax/offline/missingFile.cacheManifest6
-rw-r--r--dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/mochitest.ini101
-rw-r--r--dom/tests/mochitest/ajax/offline/namespace1/opp.html9
-rw-r--r--dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs6
-rw-r--r--dom/tests/mochitest/ajax/offline/namespace1/script.js4
-rw-r--r--dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html9
-rw-r--r--dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js4
-rw-r--r--dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js4
-rw-r--r--dom/tests/mochitest/ajax/offline/namespace2/script3.js4
-rw-r--r--dom/tests/mochitest/ajax/offline/notonwhitelist.html9
-rw-r--r--dom/tests/mochitest/ajax/offline/obsolete.html69
-rw-r--r--dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs31
-rw-r--r--dom/tests/mochitest/ajax/offline/offlineChild.html33
-rw-r--r--dom/tests/mochitest/ajax/offline/offlineTests.js436
-rw-r--r--dom/tests/mochitest/ajax/offline/onwhitelist.html9
-rw-r--r--dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^1
-rw-r--r--dom/tests/mochitest/ajax/offline/overlap.cacheManifest12
-rw-r--r--dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^1
-rw-r--r--dom/tests/mochitest/ajax/offline/redirects.sjs52
-rw-r--r--dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest7
-rw-r--r--dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/subresource744719.html1
-rw-r--r--dom/tests/mochitest/ajax/offline/test_badManifestMagic.html53
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug445544.html73
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug460353.html100
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug474696.html39
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug544462.html53
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html84
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug744719.html76
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug765203.html73
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bypass.html37
-rw-r--r--dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html58
-rw-r--r--dom/tests/mochitest/ajax/offline/test_changingManifest.html116
-rw-r--r--dom/tests/mochitest/ajax/offline/test_fallback.html130
-rw-r--r--dom/tests/mochitest/ajax/offline/test_foreign.html59
-rw-r--r--dom/tests/mochitest/ajax/offline/test_identicalManifest.html86
-rw-r--r--dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html91
-rw-r--r--dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html58
-rw-r--r--dom/tests/mochitest/ajax/offline/test_missingFile.html53
-rw-r--r--dom/tests/mochitest/ajax/offline/test_missingManifest.html33
-rw-r--r--dom/tests/mochitest/ajax/offline/test_noManifest.html43
-rw-r--r--dom/tests/mochitest/ajax/offline/test_obsolete.html42
-rw-r--r--dom/tests/mochitest/ajax/offline/test_offlineIFrame.html46
-rw-r--r--dom/tests/mochitest/ajax/offline/test_offlineMode.html164
-rw-r--r--dom/tests/mochitest/ajax/offline/test_overlap.html35
-rw-r--r--dom/tests/mochitest/ajax/offline/test_redirectManifest.html44
-rwxr-xr-xdom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html137
-rw-r--r--dom/tests/mochitest/ajax/offline/test_refetchManifest.html88
-rw-r--r--dom/tests/mochitest/ajax/offline/test_simpleManifest.html130
-rw-r--r--dom/tests/mochitest/ajax/offline/test_updateCheck.html87
-rw-r--r--dom/tests/mochitest/ajax/offline/test_updatingManifest.html346
-rw-r--r--dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml32
-rw-r--r--dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest10
-rw-r--r--dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^2
-rw-r--r--dom/tests/mochitest/ajax/offline/updatingIframe.sjs45
-rw-r--r--dom/tests/mochitest/ajax/offline/updatingImplicit.html53
-rw-r--r--dom/tests/mochitest/ajax/offline/updatingManifest.sjs66
-rw-r--r--dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest7
-rw-r--r--dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^2
-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.ini34
-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.sjs127
-rw-r--r--dom/tests/mochitest/beacon/beacon-originheader-handler.sjs48
-rw-r--r--dom/tests/mochitest/beacon/beacon-preflight-handler.sjs39
-rw-r--r--dom/tests/mochitest/beacon/beacon-redirect-handler.sjs47
-rw-r--r--dom/tests/mochitest/beacon/beacon-set-cookie.sjs8
-rw-r--r--dom/tests/mochitest/beacon/chrome.ini6
-rw-r--r--dom/tests/mochitest/beacon/file_beaconCookies.html8
-rw-r--r--dom/tests/mochitest/beacon/mochitest.ini13
-rw-r--r--dom/tests/mochitest/beacon/test_beacon.html60
-rw-r--r--dom/tests/mochitest/beacon/test_beaconContentPolicy.html102
-rw-r--r--dom/tests/mochitest/beacon/test_beaconCookies.html89
-rw-r--r--dom/tests/mochitest/beacon/test_beaconFrame.html118
-rw-r--r--dom/tests/mochitest/beacon/test_beaconOriginHeader.html67
-rw-r--r--dom/tests/mochitest/beacon/test_beaconPreflightWithCustomContentType.html57
-rw-r--r--dom/tests/mochitest/beacon/test_beaconRedirect.html62
-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.html15
-rw-r--r--dom/tests/mochitest/bugs/bug346659-parent-echoer.html5
-rw-r--r--dom/tests/mochitest/bugs/bug346659-parent.html17
-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/file_bug291653.html28
-rw-r--r--dom/tests/mochitest/bugs/file_bug406375.html5
-rw-r--r--dom/tests/mochitest/bugs/file_bug504862.html22
-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_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_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_bug38959-1.html14
-rw-r--r--dom/tests/mochitest/bugs/iframe_bug38959-2.html14
-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.html17
-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.ini164
-rw-r--r--dom/tests/mochitest/bugs/test_DOMWindowCreated_chromeonly.html14
-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.html337
-rw-r--r--dom/tests/mochitest/bugs/test_bug1171215.html89
-rw-r--r--dom/tests/mochitest/bugs/test_bug132255.html38
-rw-r--r--dom/tests/mochitest/bugs/test_bug159849.html41
-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.html110
-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_bug291653.html56
-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.html163
-rw-r--r--dom/tests/mochitest/bugs/test_bug351601.html35
-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_bug38959.html57
-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.html242
-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_bug406375.html37
-rw-r--r--dom/tests/mochitest/bugs/test_bug414291.html35
-rw-r--r--dom/tests/mochitest/bugs/test_bug427744.html33
-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_bug437361.html72
-rw-r--r--dom/tests/mochitest/bugs/test_bug440572.html48
-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_bug479143.html44
-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_bug504862.html45
-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.html80
-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_bug597809.html36
-rw-r--r--dom/tests/mochitest/bugs/test_bug61098.html339
-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_bug641552.html88
-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.html29
-rw-r--r--dom/tests/mochitest/bugs/test_bug684544.html56
-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_bug735237.html38
-rw-r--r--dom/tests/mochitest/bugs/test_bug739038.html38
-rw-r--r--dom/tests/mochitest/bugs/test_bug740811.html27
-rw-r--r--dom/tests/mochitest/bugs/test_bug743615.html84
-rw-r--r--dom/tests/mochitest/bugs/test_bug750051.html38
-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_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.html73
-rw-r--r--dom/tests/mochitest/bugs/test_onerror_message.html99
-rw-r--r--dom/tests/mochitest/bugs/test_protochains.html59
-rw-r--r--dom/tests/mochitest/bugs/test_resize_move_windows.html378
-rw-r--r--dom/tests/mochitest/bugs/test_sizetocontent_clamp.html74
-rw-r--r--dom/tests/mochitest/bugs/test_toJSON.html67
-rw-r--r--dom/tests/mochitest/bugs/test_window_bar.html97
-rw-r--r--dom/tests/mochitest/bugs/utils_bug260264.js60
-rw-r--r--dom/tests/mochitest/bugs/utils_bug743615.js25
-rw-r--r--dom/tests/mochitest/bugs/worker_bug743615.js38
-rw-r--r--dom/tests/mochitest/chrome/489127.html200
-rw-r--r--dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xul33
-rw-r--r--dom/tests/mochitest/chrome/DOMWindowCreated_content.html9
-rw-r--r--dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul110
-rw-r--r--dom/tests/mochitest/chrome/child_focus_frame.html57
-rw-r--r--dom/tests/mochitest/chrome/chrome.ini90
-rw-r--r--dom/tests/mochitest/chrome/file_DOM_element_instanceof.xul30
-rw-r--r--dom/tests/mochitest/chrome/file_MozDomFullscreen.html8
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-1_modal.xul33
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xul28
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-2_modal.xul35
-rw-r--r--dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xul46
-rw-r--r--dom/tests/mochitest/chrome/file_bug799299.xul66
-rw-r--r--dom/tests/mochitest/chrome/file_bug800817.xul80
-rw-r--r--dom/tests/mochitest/chrome/file_bug830858.xul67
-rw-r--r--dom/tests/mochitest/chrome/file_subscript_bindings.js1
-rw-r--r--dom/tests/mochitest/chrome/focus_frameset.html26
-rw-r--r--dom/tests/mochitest/chrome/focus_window2.xul27
-rw-r--r--dom/tests/mochitest/chrome/fullscreen.xul27
-rw-r--r--dom/tests/mochitest/chrome/queryCaretRectUnix.html214
-rw-r--r--dom/tests/mochitest/chrome/queryCaretRectWin.html223
-rw-r--r--dom/tests/mochitest/chrome/selectAtPoint.html281
-rw-r--r--dom/tests/mochitest/chrome/sizemode_attribute.xul87
-rw-r--r--dom/tests/mochitest/chrome/test_DOMWindowCreated.xul29
-rw-r--r--dom/tests/mochitest/chrome/test_DOM_element_instanceof.xul34
-rw-r--r--dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul56
-rw-r--r--dom/tests/mochitest/chrome/test_activation.xul42
-rw-r--r--dom/tests/mochitest/chrome/test_bug1224790-1.xul71
-rw-r--r--dom/tests/mochitest/chrome/test_bug1224790-2.xul72
-rw-r--r--dom/tests/mochitest/chrome/test_bug799299.xul31
-rw-r--r--dom/tests/mochitest/chrome/test_bug800817.xul43
-rw-r--r--dom/tests/mochitest/chrome/test_bug830396.xul39
-rw-r--r--dom/tests/mochitest/chrome/test_bug830858.xul36
-rw-r--r--dom/tests/mochitest/chrome/test_callback_wrapping.xul22
-rw-r--r--dom/tests/mochitest/chrome/test_clipboard_events_chrome.html63
-rw-r--r--dom/tests/mochitest/chrome/test_clonewrapper.xul117
-rw-r--r--dom/tests/mochitest/chrome/test_cyclecollector.xul55
-rw-r--r--dom/tests/mochitest/chrome/test_docshell_swap.xul74
-rw-r--r--dom/tests/mochitest/chrome/test_focus.xul33
-rw-r--r--dom/tests/mochitest/chrome/test_focus_docnav.xul28
-rw-r--r--dom/tests/mochitest/chrome/test_focus_switchbinding.xul57
-rw-r--r--dom/tests/mochitest/chrome/test_focused_link_scroll.xul48
-rw-r--r--dom/tests/mochitest/chrome/test_fullscreen.xul37
-rw-r--r--dom/tests/mochitest/chrome/test_geolocation.xul35
-rw-r--r--dom/tests/mochitest/chrome/test_indexedSetter.html38
-rw-r--r--dom/tests/mochitest/chrome/test_moving_nodeList.xul45
-rw-r--r--dom/tests/mochitest/chrome/test_moving_xhr.xul41
-rw-r--r--dom/tests/mochitest/chrome/test_nodesFromRect.html21
-rw-r--r--dom/tests/mochitest/chrome/test_parsingMode.html67
-rw-r--r--dom/tests/mochitest/chrome/test_popup_blocker_chrome.xul54
-rw-r--r--dom/tests/mochitest/chrome/test_queryCaretRect.html22
-rw-r--r--dom/tests/mochitest/chrome/test_resize_move_windows.xul282
-rw-r--r--dom/tests/mochitest/chrome/test_sandbox_bindings.xul318
-rw-r--r--dom/tests/mochitest/chrome/test_sandbox_eventhandler.xul38
-rw-r--r--dom/tests/mochitest/chrome/test_sandbox_image.xul37
-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.xul26
-rw-r--r--dom/tests/mochitest/chrome/test_subscript_bindings.xul44
-rw-r--r--dom/tests/mochitest/chrome/test_xray_event_constructor.xul35
-rw-r--r--dom/tests/mochitest/chrome/window_activation.xul37
-rw-r--r--dom/tests/mochitest/chrome/window_callback_wrapping.xul21
-rw-r--r--dom/tests/mochitest/chrome/window_docshell_swap.xul8
-rw-r--r--dom/tests/mochitest/chrome/window_focus.xul1729
-rw-r--r--dom/tests/mochitest/chrome/window_focus_docnav.xul126
-rw-r--r--dom/tests/mochitest/crypto/mochitest.ini1
-rw-r--r--dom/tests/mochitest/crypto/test_getRandomValues.html212
-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/framed_location.html11
-rw-r--r--dom/tests/mochitest/dom-level0/idn_child.html101
-rw-r--r--dom/tests/mochitest/dom-level0/innerWidthHeight_script.html30
-rw-r--r--dom/tests/mochitest/dom-level0/mochitest.ini19
-rw-r--r--dom/tests/mochitest/dom-level0/test_crossdomainprops.html36
-rw-r--r--dom/tests/mochitest/dom-level0/test_innerWidthHeight_script.html31
-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.html78
-rw-r--r--dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html211
-rw-r--r--dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html35
-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.ini268
-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.ini876
-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_HTMLAppletElement01.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement02.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement03.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement04.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement05.html136
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement06.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement07.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement08.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement09.html137
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement10.html135
-rw-r--r--dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement11.html138
-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_HTMLDocument08.html137
-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_temporaryFileBlob.js39
-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/message_receiver.html6
-rw-r--r--dom/tests/mochitest/fetch/mochitest.ini57
-rw-r--r--dom/tests/mochitest/fetch/nested_worker_wrapper.js28
-rw-r--r--dom/tests/mochitest/fetch/reroute.html18
-rw-r--r--dom/tests/mochitest/fetch/reroute.js24
-rw-r--r--dom/tests/mochitest/fetch/reroute.js^headers^1
-rw-r--r--dom/tests/mochitest/fetch/sw_reroute.js31
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic.js104
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http.js201
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http_sw_empty_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_http_sw_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_sw_empty_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_basic_sw_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors.html23
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors.js1748
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors_sw_empty_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_fetch_cors_sw_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_formdataparsing.html23
-rw-r--r--dom/tests/mochitest/fetch/test_formdataparsing.js283
-rw-r--r--dom/tests/mochitest/fetch/test_formdataparsing_sw_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_headers.html17
-rw-r--r--dom/tests/mochitest/fetch/test_headers_common.js229
-rw-r--r--dom/tests/mochitest/fetch/test_headers_mainthread.html155
-rw-r--r--dom/tests/mochitest/fetch/test_headers_sw_reroute.html16
-rw-r--r--dom/tests/mochitest/fetch/test_request.html23
-rw-r--r--dom/tests/mochitest/fetch/test_request.js542
-rw-r--r--dom/tests/mochitest/fetch/test_request_context.html19
-rw-r--r--dom/tests/mochitest/fetch/test_request_sw_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_response.html23
-rw-r--r--dom/tests/mochitest/fetch/test_response.js267
-rw-r--r--dom/tests/mochitest/fetch/test_response_sw_reroute.html22
-rw-r--r--dom/tests/mochitest/fetch/test_temporaryFileBlob.html35
-rw-r--r--dom/tests/mochitest/fetch/utils.js37
-rw-r--r--dom/tests/mochitest/fetch/worker_temporaryFileBlob.js21
-rw-r--r--dom/tests/mochitest/fetch/worker_wrapper.js58
-rw-r--r--dom/tests/mochitest/gamepad/gamepad_frame.html20
-rw-r--r--dom/tests/mochitest/gamepad/gamepad_frame_state.html16
-rw-r--r--dom/tests/mochitest/gamepad/mochitest.ini12
-rw-r--r--dom/tests/mochitest/gamepad/mock_gamepad.js12
-rw-r--r--dom/tests/mochitest/gamepad/test_check_timestamp.html65
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad.html71
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_connect_events.html76
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html102
-rw-r--r--dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html79
-rw-r--r--dom/tests/mochitest/gamepad/test_navigator_gamepads.html111
-rw-r--r--dom/tests/mochitest/general/497633.html24
-rw-r--r--dom/tests/mochitest/general/chrome.ini9
-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.html36
-rw-r--r--dom/tests/mochitest/general/file_domWindowUtils_scrollbarSize.html7
-rw-r--r--dom/tests/mochitest/general/file_frameElementWrapping.html32
-rw-r--r--dom/tests/mochitest/general/file_interfaces.xml20
-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_showModalDialog.html35
-rw-r--r--dom/tests/mochitest/general/frameSelectEvents.html467
-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.sjs33
-rw-r--r--dom/tests/mochitest/general/frameStoragePrevented.html47
-rw-r--r--dom/tests/mochitest/general/historyframes.html156
-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/mochitest.ini128
-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.html101
-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.html187
-rw-r--r--dom/tests/mochitest/general/resource_timing_iframe.html49
-rw-r--r--dom/tests/mochitest/general/resource_timing_main_test.html288
-rw-r--r--dom/tests/mochitest/general/storagePermissionsUtils.js237
-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.html29
-rw-r--r--dom/tests/mochitest/general/test_DOMMatrix.html728
-rw-r--r--dom/tests/mochitest/general/test_WebKitCSSMatrix.html336
-rw-r--r--dom/tests/mochitest/general/test_bug1012662_common.js341
-rw-r--r--dom/tests/mochitest/general/test_bug1012662_editor.html29
-rw-r--r--dom/tests/mochitest/general/test_bug1012662_noeditor.html28
-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.html32
-rw-r--r--dom/tests/mochitest/general/test_bug1313753.html61
-rw-r--r--dom/tests/mochitest/general/test_bug504220.html66
-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.html130
-rw-r--r--dom/tests/mochitest/general/test_clipboard_disallowed.html61
-rw-r--r--dom/tests/mochitest/general/test_clipboard_events.html725
-rw-r--r--dom/tests/mochitest/general/test_consoleAPI.html67
-rw-r--r--dom/tests/mochitest/general/test_contentViewer_overrideDPPX.html358
-rw-r--r--dom/tests/mochitest/general/test_domWindowUtils.html197
-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_focusrings.xul175
-rw-r--r--dom/tests/mochitest/general/test_for_of.html25
-rw-r--r--dom/tests/mochitest/general/test_frameElementWrapping.html45
-rw-r--r--dom/tests/mochitest/general/test_framedhistoryframes.html31
-rw-r--r--dom/tests/mochitest/general/test_idleapi_permissions.html48
-rw-r--r--dom/tests/mochitest/general/test_img_mutations.html236
-rw-r--r--dom/tests/mochitest/general/test_innerScreen.xul89
-rw-r--r--dom/tests/mochitest/general/test_interfaces.html1383
-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_offsets.css3
-rw-r--r--dom/tests/mochitest/general/test_offsets.html100
-rw-r--r--dom/tests/mochitest/general/test_offsets.js222
-rw-r--r--dom/tests/mochitest/general/test_offsets.xul99
-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_now.html66
-rw-r--r--dom/tests/mochitest/general/test_performance_timeline.html36
-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_resource_timing.html38
-rw-r--r--dom/tests/mochitest/general/test_resource_timing_cross_origin.html45
-rw-r--r--dom/tests/mochitest/general/test_resource_timing_frameset.html29
-rw-r--r--dom/tests/mochitest/general/test_selectevents.html32
-rw-r--r--dom/tests/mochitest/general/test_showModalDialog.html60
-rw-r--r--dom/tests/mochitest/general/test_showModalDialog_e10s.html32
-rw-r--r--dom/tests/mochitest/general/test_spacetopagedown.html76
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsAccept.html42
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsLimitForeign.html44
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsReject.html42
-rw-r--r--dom/tests/mochitest/general/test_storagePermissionsRejectForeign.html42
-rw-r--r--dom/tests/mochitest/general/test_stylesheetPI.html37
-rw-r--r--dom/tests/mochitest/general/test_vibrator.html93
-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/workerStorageAllowed.js61
-rw-r--r--dom/tests/mochitest/general/workerStoragePrevented.js61
-rw-r--r--dom/tests/mochitest/geolocation/chrome.ini6
-rw-r--r--dom/tests/mochitest/geolocation/geolocation.html13
-rw-r--r--dom/tests/mochitest/geolocation/geolocation_common.js92
-rw-r--r--dom/tests/mochitest/geolocation/mochitest.ini28
-rw-r--r--dom/tests/mochitest/geolocation/network_geolocation.sjs78
-rw-r--r--dom/tests/mochitest/geolocation/test_allowCurrent.html41
-rw-r--r--dom/tests/mochitest/geolocation/test_allowWatch.html43
-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.html72
-rw-r--r--dom/tests/mochitest/geolocation/test_clearWatchBeforeAllowing.html59
-rw-r--r--dom/tests/mochitest/geolocation/test_clearWatch_invalid.html47
-rw-r--r--dom/tests/mochitest/geolocation/test_errorcheck.html49
-rw-r--r--dom/tests/mochitest/geolocation/test_garbageWatch.html56
-rw-r--r--dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html35
-rw-r--r--dom/tests/mochitest/geolocation/test_handlerSpinsEventLoop.html72
-rw-r--r--dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html58
-rw-r--r--dom/tests/mochitest/geolocation/test_manyCurrentSerial.html47
-rw-r--r--dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html57
-rw-r--r--dom/tests/mochitest/geolocation/test_manyWatchSerial.html54
-rw-r--r--dom/tests/mochitest/geolocation/test_manyWindows.html67
-rw-r--r--dom/tests/mochitest/geolocation/test_optional_api_params.html102
-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.html69
-rw-r--r--dom/tests/mochitest/geolocation/test_windowClose.html36
-rw-r--r--dom/tests/mochitest/geolocation/test_worseAccuracyDoesNotBlockCallback.html47
-rw-r--r--dom/tests/mochitest/geolocation/windowTest.html40
-rw-r--r--dom/tests/mochitest/localstorage/chrome.ini11
-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.html20
-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/frameQuota.html105
-rw-r--r--dom/tests/mochitest/localstorage/frameQuotaSessionOnly.html111
-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.js57
-rw-r--r--dom/tests/mochitest/localstorage/interOriginTest.js42
-rw-r--r--dom/tests/mochitest/localstorage/interOriginTest2.js53
-rw-r--r--dom/tests/mochitest/localstorage/localStorageCommon.js45
-rw-r--r--dom/tests/mochitest/localstorage/mochitest.ini52
-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.html166
-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.html42
-rw-r--r--dom/tests/mochitest/localstorage/test_cookieSession.html132
-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.html263
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageBaseSessionOnly.html205
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html59
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageEnablePref.html65
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml58
-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.html111
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html192
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html112
-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_localStorageSessionPrefOverride.html54
-rw-r--r--dom/tests/mochitest/localstorage/test_lowDeviceStorage.html76
-rw-r--r--dom/tests/mochitest/localstorage/test_storageConstructor.html35
-rw-r--r--dom/tests/mochitest/notification/MockServices.js117
-rw-r--r--dom/tests/mochitest/notification/NotificationTest.js136
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/create_notification.html16
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/moz.build6
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/notification_common.js70
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html50
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/test_basic_notification_click.html53
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/test_leak_windowClose.html34
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/test_notification_tag.html110
-rw-r--r--dom/tests/mochitest/notification/desktop-notification/test_system_principal.xul85
-rw-r--r--dom/tests/mochitest/notification/mochitest.ini10
-rw-r--r--dom/tests/mochitest/notification/test_bug931307.html34
-rw-r--r--dom/tests/mochitest/notification/test_notification_basics.html129
-rw-r--r--dom/tests/mochitest/notification/test_notification_storage.html158
-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.html66
-rw-r--r--dom/tests/mochitest/pointerlock/file_escapeKey.html77
-rw-r--r--dom/tests/mochitest/pointerlock/file_infiniteMovement.html103
-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.html104
-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.html207
-rw-r--r--dom/tests/mochitest/pointerlock/file_screenClientXYConst.html132
-rw-r--r--dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html158
-rw-r--r--dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html68
-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.ini28
-rw-r--r--dom/tests/mochitest/pointerlock/pointerlock_utils.js120
-rw-r--r--dom/tests/mochitest/pointerlock/test_closewindow-with-pointerlock.html51
-rw-r--r--dom/tests/mochitest/pointerlock/test_pointerlock-api.html101
-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.html43
-rw-r--r--dom/tests/mochitest/sessionstorage/frameReplace.html75
-rw-r--r--dom/tests/mochitest/sessionstorage/interOriginSlave.js42
-rw-r--r--dom/tests/mochitest/sessionstorage/interOriginTest.js44
-rw-r--r--dom/tests/mochitest/sessionstorage/mochitest.ini18
-rw-r--r--dom/tests/mochitest/sessionstorage/test_cookieSession.html124
-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.html94
-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/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.html66
-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.js56
-rw-r--r--dom/tests/mochitest/storageevent/interOriginTest2.js59
-rw-r--r--dom/tests/mochitest/storageevent/mochitest.ini17
-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.html127
-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/inert_style.css10
-rw-r--r--dom/tests/mochitest/webcomponents/mochitest.ini48
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug1017896.html32
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug1176757.html40
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug1276240.html55
-rw-r--r--dom/tests/mochitest/webcomponents/test_bug900724.html32
-rw-r--r--dom/tests/mochitest/webcomponents/test_content_element.html131
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_adopt_callbacks.html29
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html47
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_clone_callbacks.html54
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_clone_callbacks_extended.html40
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_get.html31
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_import_node_created_callback.html34
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html132
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_register_invalid_callbacks.html72
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_when_defined.html140
-rw-r--r--dom/tests/mochitest/webcomponents/test_dest_insertion_points.html73
-rw-r--r--dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html68
-rw-r--r--dom/tests/mochitest/webcomponents/test_detached_style.html25
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_adoptnode.html36
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_importnode.html37
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_register.html163
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_register_base_queue.html48
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_register_lifecycle.html402
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_register_parser.html47
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_register_stack.html152
-rw-r--r--dom/tests/mochitest/webcomponents/test_document_shared_registry.html79
-rw-r--r--dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html50
-rw-r--r--dom/tests/mochitest/webcomponents/test_event_dispatch.html458
-rw-r--r--dom/tests/mochitest/webcomponents/test_event_retarget.html147
-rw-r--r--dom/tests/mochitest/webcomponents/test_event_stopping.html168
-rw-r--r--dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html71
-rw-r--r--dom/tests/mochitest/webcomponents/test_link_prefetch.html110
-rw-r--r--dom/tests/mochitest/webcomponents/test_nested_content_element.html127
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadow_element.html173
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot.html83
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_host.html41
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html44
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_style.html83
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html57
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html42
-rw-r--r--dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html41
-rw-r--r--dom/tests/mochitest/webcomponents/test_style_fallback_content.html28
-rw-r--r--dom/tests/mochitest/webcomponents/test_template.html153
-rw-r--r--dom/tests/mochitest/webcomponents/test_template_custom_elements.html32
-rw-r--r--dom/tests/mochitest/webcomponents/test_template_xhtml.html46
-rw-r--r--dom/tests/mochitest/webcomponents/test_unresolved_pseudo_class.html99
-rw-r--r--dom/tests/mochitest/whatwg/browserFu.js6
-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.ini44
-rw-r--r--dom/tests/mochitest/whatwg/postMessage.jarbin0 -> 616 bytes
-rw-r--r--dom/tests/mochitest/whatwg/postMessage.jar^headers^1
-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.html110
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_idn_helper.html41
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_joined_helper.html91
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_joined_helper2.html78
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_onOther.html109
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml37
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_override_helper.html42
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html106
-rw-r--r--dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.js63
-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.html103
-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.html771
-rw-r--r--dom/tests/mochitest/whatwg/test_document_scripts.html55
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage.html166
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_basehref.html46
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_chrome.html114
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_closed.html78
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_hash.html45
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml71
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_jar.html52
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_joined.html58
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_onOther.html51
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml545
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_override.html103
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_special.xhtml311
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html68
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_throw.html74
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_transfer.html62
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_userpass.html46
2624 files changed, 325870 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/jquery/ChangeLog.txt b/dom/tests/mochitest/ajax/jquery/ChangeLog.txt
new file mode 100644
index 000000000..6d834c196
--- /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 000000000..11dddd00e
--- /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 000000000..d4215f0e4
--- /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 000000000..a28e7cd65
--- /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 000000000..d33c00c7f
--- /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 000000000..110b669ae
--- /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 = toolkit == 'android' #bug 775227
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 000000000..2c5b67225
--- /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 000000000..10f6b3347
--- /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 000000000..3ff26e161
--- /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 000000000..867251dad
--- /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 000000000..7fa61820f
--- /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 000000000..0fa32d1a8
--- /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 000000000..3bbc8417d
--- /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 000000000..8d69aae94
--- /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 000000000..89aae83e4
--- /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 000000000..494f64058
--- /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 000000000..10116af65
--- /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 000000000..5d15b903b
--- /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 000000000..fc6dc3860
--- /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 000000000..f8bdd091e
--- /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 000000000..ebf610e43
--- /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 000000000..909d41745
--- /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 000000000..28f1a346c
--- /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 000000000..4801becd6
--- /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 000000000..88e0e49d5
--- /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 000000000..f4edab791
--- /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 000000000..8608f430b
--- /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 000000000..f802dea34
--- /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 000000000..e76b795a2
--- /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 000000000..b60d39e72
--- /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 000000000..74a03192c
--- /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 000000000..aac1655f5
--- /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 000000000..c393f6d62
--- /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 000000000..77a54bf65
--- /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 000000000..55c3c436a
--- /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 000000000..07c4434d0
--- /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 000000000..756a68aaa
--- /dev/null
+++ b/dom/tests/mochitest/ajax/jquery/test_jQuery.html
@@ -0,0 +1,15 @@
+<!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" 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 000000000..3c43790f5
--- /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 000000000..e94531db0
--- /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 000000000..38a401402
--- /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 000000000..55f4857b9
--- /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 000000000..ec1350e60
--- /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 000000000..708f49017
--- /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 000000000..c044ef2ab
--- /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 000000000..02fe5bfb9
--- /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 000000000..c0b03ee9d
--- /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 000000000..c471ffe90
--- /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 000000000..937b681f7
--- /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 000000000..c2fcbeee0
--- /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 000000000..4d25c3e78
--- /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 lame 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 000000000..3798ae404
--- /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 000000000..3a13b241f
--- /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 000000000..92558cb7b
--- /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 000000000..23b0f181c
--- /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 000000000..f5d1afac3
--- /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 000000000..3e5789160
--- /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 crazy 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 000000000..8976ec0b2
--- /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 000000000..93e77862a
--- /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 000000000..494a5b440
--- /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 000000000..b7d8d87b2
--- /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 000000000..8d644b19e
--- /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 000000000..5bf0e943d
--- /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 000000000..25f301e30
--- /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 000000000..a94ce14a4
--- /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 000000000..639519ecf
--- /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 000000000..32889ea82
--- /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 000000000..3db71e1e7
--- /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 000000000..bad32dfb1
--- /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 000000000..45036d9c7
--- /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 000000000..43ad9d4ab
--- /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 000000000..a191a53be
--- /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 000000000..58bffa6bf
--- /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 000000000..8086acc2d
--- /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 000000000..53a0e0ed0
--- /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 000000000..d92229a6e
--- /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 000000000..d1a8b60d8
--- /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 000000000..503acef07
--- /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 000000000..9c37416d6
--- /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 000000000..b01adc6e7
--- /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 000000000..e4a40c7e4
--- /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 000000000..73709775d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/SimpleTest.js
@@ -0,0 +1,463 @@
+/**
+ * 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, 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.ok(a == b, name, "got " + repr(a) + ", expected " + repr(b));
+};
+
+SimpleTest.isnot = function (a, b, name) {
+ var repr = MochiKit.Base.repr;
+ SimpleTest.ok(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 oldOK = SimpleTest.ok;
+
+ SimpleTest.ok = function(condition, name, diag) {
+ parent.SimpleTest.ok( condition, name, diag );
+ return oldOK( condition, name, diag );
+ };
+
+ var oldFinish = SimpleTest.finish;
+
+ SimpleTest.finish = function() {
+ oldFinish();
+ parent.runAJAXTest();
+ };
+})();
+
+// Global symbols:
+var ok = SimpleTest.ok;
+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 000000000..a4e313075
--- /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 000000000..38a401402
--- /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 000000000..18434604c
--- /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 000000000..da46bd32c
--- /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 000000000..d48571238
--- /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 000000000..2cbf2848d
--- /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 000000000..17d418d8c
--- /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.ok( Color.whiteColor().toRGBString(), "rgb(255,255,255)", "toRGBString white" );
+ t.ok( 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 000000000..cc2d958e3
--- /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 000000000..d3a3c5837
--- /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 000000000..785cebf82
--- /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 000000000..d0ff146ad
--- /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 000000000..66f4989b0
--- /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 000000000..037e18c81
--- /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 000000000..6a905952f
--- /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/offline/445544.cacheManifest b/dom/tests/mochitest/ajax/offline/445544.cacheManifest
new file mode 100644
index 000000000..eb957d3df
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/445544.cacheManifest
@@ -0,0 +1,8 @@
+CACHE MANIFEST
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+test_bug445544.html
+445544_part1.html
+
+# not including 445544_part2.html
diff --git a/dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/445544.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/445544_part1.html b/dom/tests/mochitest/ajax/offline/445544_part1.html
new file mode 100644
index 000000000..d5219e4b7
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/445544_part1.html
@@ -0,0 +1,9 @@
+<html manifest="445544.cacheManifest">
+<head>
+<title>testing navigation part 1</title>
+</head>
+
+<body onload="window.opener.part1loaded(window.applicationCache.status)">
+testing navigation...
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/445544_part2.html b/dom/tests/mochitest/ajax/offline/445544_part2.html
new file mode 100644
index 000000000..74dec4a9a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/445544_part2.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title>testing navigation part 2</title>
+</head>
+
+<body onload="window.opener.part2loaded()">
+success.
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html
new file mode 100644
index 000000000..75b297bbd
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/460353_iframe_nomanifest.html
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Bug 460353, iframe with no manifest reference</title>
+
+</head>
+<body onload="parent.frameOnLoad('noman', applicationCache.status);">
+ This is an iframe without a manifest reference
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html
new file mode 100644
index 000000000..3959510ab
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/460353_iframe_ownmanifest.html
@@ -0,0 +1,37 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="updatingManifest.sjs">
+<head>
+<title>Bug 460353, iframe with a different manifest reference</title>
+
+<script type="text/javascript">
+
+applicationCache.onerror = function() {
+ parent.frameOnUpdate("diff", false);
+}
+
+applicationCache.oncached = function() {
+ parent.frameOnUpdate("diff", true, applicationCache.status);
+
+ /* This code tries to figure out what cache is really
+ associated to this document, but hangs on getter2.getInterface
+ from for now unknown reasons. Commenting this out.
+
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
+ var Ci = Components.interfaces;
+
+ var getter1 = window.QueryInterface(Ci.nsIInterfaceRequestor);
+ var webnav = getter1.getInterface(Ci.nsIWebNavigation);
+ var getter2 = webnav.QueryInterface(Ci.nsIInterfaceRequestor);
+ var cacheCont = getter2.getInterface(Ci.nsIApplicationCacheContainer);
+ var cache = cacheCont.applicationCache;
+ dump(cache.groupID);
+ */
+}
+
+</script>
+
+</head>
+<body onload="parent.frameOnLoad('diff', applicationCache.status);">
+ This is an iframe with a different manifest reference
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html
new file mode 100644
index 000000000..de357827b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html
@@ -0,0 +1,25 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="simpleManifest.cacheManifest">
+<head>
+<title>Bug 460353, iframe with a different manifest reference</title>
+
+<script type="text/javascript">
+
+applicationCache.onerror = function() {
+ parent.frameOnUpdate("same", false);
+}
+
+applicationCache.oncached = function() {
+ parent.frameOnUpdate("same", true, applicationCache.status);
+}
+
+applicationCache.onnoupdate = function() {
+ parent.frameOnUpdate("same", true, applicationCache.status);
+}
+
+</script>
+
+</head>
+<body onload="parent.frameOnLoad('same', applicationCache.status);">
+ This is an iframe with the same manifest reference
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest
new file mode 100644
index 000000000..a8a7a3bf6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest
@@ -0,0 +1,37 @@
+CACHE MANIFEST
+
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+# more than 15 what is a number of parallel loads
+subresource744719.html?001
+subresource744719.html?002
+subresource744719.html?003
+subresource744719.html?004
+subresource744719.html?005
+subresource744719.html?006
+subresource744719.html?007
+subresource744719.html?008
+subresource744719.html?009
+# this one is non existing and should cancel the load
+nonexistent744719.html?010
+subresource744719.html?011
+subresource744719.html?012
+subresource744719.html?013
+subresource744719.html?014
+subresource744719.html?015
+subresource744719.html?016
+subresource744719.html?017
+subresource744719.html?018
+subresource744719.html?019
+subresource744719.html?020
+subresource744719.html?021
+subresource744719.html?022
+subresource744719.html?023
+subresource744719.html?024
+subresource744719.html?025
+subresource744719.html?026
+subresource744719.html?027
+subresource744719.html?028
+subresource744719.html?029
+subresource744719.html?030
diff --git a/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/744719.cacheManifest b/dom/tests/mochitest/ajax/offline/744719.cacheManifest
new file mode 100644
index 000000000..c8246cb44
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/744719.cacheManifest
@@ -0,0 +1,36 @@
+CACHE MANIFEST
+
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+# more than 15 what is a number of parallel loads
+subresource744719.html?001
+subresource744719.html?002
+subresource744719.html?003
+subresource744719.html?004
+subresource744719.html?005
+subresource744719.html?006
+subresource744719.html?007
+subresource744719.html?008
+subresource744719.html?009
+subresource744719.html?010
+subresource744719.html?011
+subresource744719.html?012
+subresource744719.html?013
+subresource744719.html?014
+subresource744719.html?015
+subresource744719.html?016
+subresource744719.html?017
+subresource744719.html?018
+subresource744719.html?019
+subresource744719.html?020
+subresource744719.html?021
+subresource744719.html?022
+subresource744719.html?023
+subresource744719.html?024
+subresource744719.html?025
+subresource744719.html?026
+subresource744719.html?027
+subresource744719.html?028
+subresource744719.html?029
+subresource744719.html?030
diff --git a/dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/744719.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest
new file mode 100644
index 000000000..18d84ab6e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest
@@ -0,0 +1,3 @@
+# This doesn't start with the magic cache manifest line.
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
diff --git a/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/bypass.cacheManifest b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest
new file mode 100644
index 000000000..ec31a901d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest
@@ -0,0 +1,7 @@
+CACHE MANIFEST
+
+bypass.html
+
+NETWORK:
+namespace1/sub
+namespace2
diff --git a/dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/bypass.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/bypass.html b/dom/tests/mochitest/ajax/offline/bypass.html
new file mode 100644
index 000000000..f5bf71e9e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/bypass.html
@@ -0,0 +1,41 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="bypass.cacheManifest">
+<head>
+
+<script type="text/javascript" src="namespace1/script.js"></script>
+<script type="text/javascript" src="namespace1/sub/script1.js"></script>
+<script type="text/javascript" src="namespace1/sub2/script2.js"></script>
+<script type="text/javascript" src="namespace2/script3.js"></script>
+
+<script class="testbody" type="text/javascript">
+
+function testScriptPresence(scriptPath, func, shouldPass)
+{
+ var msg = "Script " + scriptPath + (shouldPass ? " loaded" : " not loaded");
+ try {
+ eval(func);
+ opener.OfflineTest.ok(shouldPass, msg);
+ }
+ catch(ex) {
+ opener.OfflineTest.ok(!shouldPass, msg);
+ }
+
+}
+
+function startTest()
+{
+ testScriptPresence("namespace1/script.js", "scriptNo0Function();", false);
+ testScriptPresence("namespace1/sub/script1.js", "scriptNo1Function();", true);
+ testScriptPresence("namespace1/sub2/script2.js", "scriptNo2Function();", true);
+ testScriptPresence("namespace2/script3.js", "scriptNo3Function();", true);
+
+ opener.OfflineTest.teardownAndFinish();
+ window.close(window);
+}
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/changing1Hour.sjs b/dom/tests/mochitest/ajax/offline/changing1Hour.sjs
new file mode 100644
index 000000000..2a1035965
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/changing1Hour.sjs
@@ -0,0 +1,8 @@
+function handleRequest(request, response)
+{
+ response.setStatusLine(request.httpVersion, 200, "Ok");
+ response.setHeader("Content-Type", "text/plain");
+ response.setHeader("Cache-Control", "max-age=3600");
+
+ response.write(Date.now());
+}
diff --git a/dom/tests/mochitest/ajax/offline/changing1Sec.sjs b/dom/tests/mochitest/ajax/offline/changing1Sec.sjs
new file mode 100644
index 000000000..cb9428b6c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/changing1Sec.sjs
@@ -0,0 +1,9 @@
+function handleRequest(request, response)
+{
+ response.setStatusLine(request.httpVersion, 200, "Ok");
+ response.setHeader("Content-Type", "text/plain");
+ response.setHeader("Cache-Control", "max-age=1");
+
+ response.write(Date.now());
+}
+
diff --git a/dom/tests/mochitest/ajax/offline/changingManifest.sjs b/dom/tests/mochitest/ajax/offline/changingManifest.sjs
new file mode 100644
index 000000000..4d178d1dd
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/changingManifest.sjs
@@ -0,0 +1,27 @@
+function handleRequest(request, response)
+{
+ var match = request.queryString.match(/^state=(.*)$/);
+ if (match)
+ {
+ response.setStatusLine(request.httpVersion, 204, "No content");
+ setState("offline.changingManifest", match[1]);
+ }
+
+ if (request.queryString == "")
+ {
+ response.setStatusLine(request.httpVersion, 200, "Ok");
+ response.setHeader("Content-Type", "text/cache-manifest");
+ response.setHeader("Cache-Control", "no-cache");
+ response.write(
+ "CACHE MANIFEST\n" +
+ "# v" + getState("offline.changingManifest") + "\n" +
+ "changing1Hour.sjs\n" +
+ "changing1Sec.sjs\n");
+
+ if (getState("offline.changingManifest") != "2") {
+ response.write(
+ "NETWORK:\n" +
+ "onwhitelist.html\n");
+ }
+ }
+}
diff --git a/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs
new file mode 100644
index 000000000..1ce865a8a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs
@@ -0,0 +1,27 @@
+function handleRequest(request, response)
+{
+ var match = request.queryString.match(/^state=(.*)$/);
+ if (match)
+ {
+ response.setStatusLine(request.httpVersion, 200, "No content");
+ setState("state", match[1]);
+ response.write("state='" + match[1] + "'");
+ }
+
+ if (request.queryString == "")
+ {
+ switch (getState("state"))
+ {
+ case "": // The default value
+ response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
+ response.setHeader("Location", "http://example.com/non-existing-dynamic.html");
+ response.setHeader("Content-Type", "text/html");
+ break;
+ case "on":
+ response.setStatusLine(request.httpVersion, 200, "OK");
+ response.setHeader("Content-Type", "text/html");
+ response.write("<html><body>Dynamic page</body></html>");
+ break;
+ }
+ }
+}
diff --git a/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs b/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs
new file mode 100644
index 000000000..54da8be5d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs
@@ -0,0 +1,27 @@
+function handleRequest(request, response)
+{
+ var match = request.queryString.match(/^state=(.*)$/);
+ if (match)
+ {
+ response.setStatusLine(request.httpVersion, 200, "No content");
+ setState("state", match[1]);
+ response.write("state='" + match[1] + "'");
+ }
+
+ if (request.queryString == "")
+ {
+ switch (getState("state"))
+ {
+ case "": // The default value
+ response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
+ response.setHeader("Location", "http://example.com/non-existing-explicit.html");
+ response.setHeader("Content-Type", "text/html");
+ break;
+ case "on":
+ response.setStatusLine(request.httpVersion, 200, "OK");
+ response.setHeader("Content-Type", "text/html");
+ response.write("<html><body>Explicit page</body></html>");
+ break;
+ }
+ }
+}
diff --git a/dom/tests/mochitest/ajax/offline/fallback.cacheManifest b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest
new file mode 100644
index 000000000..ec31b2a4a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest
@@ -0,0 +1,11 @@
+CACHE MANIFEST
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+FALLBACK:
+namespace1/ fallback.html
+namespace1/sub/ fallback2.html
+namespace2/ fallbackTop.html
+
+NETWORK:
+onwhitelist.html
diff --git a/dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/fallback.html b/dom/tests/mochitest/ajax/offline/fallback.html
new file mode 100644
index 000000000..4f5b39e31
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/fallback.html
@@ -0,0 +1,12 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>fallback page for fallback test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+</head>
+<body onload="parent.onFallbackLoad(1);">
+Fallback page
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/fallback2.html b/dom/tests/mochitest/ajax/offline/fallback2.html
new file mode 100644
index 000000000..11890f65d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/fallback2.html
@@ -0,0 +1,12 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>fallback page for fallback test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+</head>
+<body onload="parent.onFallbackLoad(2);">
+Sub fallback page
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/fallbackTop.html b/dom/tests/mochitest/ajax/offline/fallbackTop.html
new file mode 100644
index 000000000..5de4316c0
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/fallbackTop.html
@@ -0,0 +1,8 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Fallback for top window</title>
+</head>
+
+<body onLoad="window.opener.onFallbackLoad(100);">
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest
new file mode 100644
index 000000000..4b713f844
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest
@@ -0,0 +1,3 @@
+CACHE MANIFEST
+
+foreign2.html
diff --git a/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest
new file mode 100644
index 000000000..4b713f844
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest
@@ -0,0 +1,3 @@
+CACHE MANIFEST
+
+foreign2.html
diff --git a/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/foreign2.html b/dom/tests/mochitest/ajax/offline/foreign2.html
new file mode 100644
index 000000000..40d5dc11d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/foreign2.html
@@ -0,0 +1,69 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest">
+<head>
+<title>Foreign page 2</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+function manifestUpdated()
+{
+ var appCacheService = SpecialPowers.Cc["@mozilla.org/network/application-cache-service;1"]
+ .getService(SpecialPowers.Ci.nsIApplicationCacheService);
+
+ var foreign2cache = appCacheService.chooseApplicationCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo());
+
+ window.opener.OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html");
+ window.opener.OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest")
+
+ var foreign1cache = OfflineTest.getActiveCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
+ window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded");
+ foreign1cache.discard();
+
+ window.opener.onDone();
+}
+
+function onLoaded()
+{
+ var appCacheService = SpecialPowers.Cc["@mozilla.org/network/application-cache-service;1"]
+ .getService(SpecialPowers.Ci.nsIApplicationCacheService);
+
+ var foreign1cache = window.opener.OfflineTest.getActiveCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
+ window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded");
+
+ var foreign2cache = window.opener.OfflineTest.getActiveCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest");
+ window.opener.OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present");
+
+ foreign1cache = appCacheService.chooseApplicationCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", window.opener.OfflineTest.loadContextInfo());
+ window.opener.OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache");
+
+ try
+ {
+ window.opener.OfflineTest.ok(applicationCache.status == SpecialPowers.Ci.nsIDOMOfflineResourceList.UNCACHED,
+ "there is no associated application cache");
+ }
+ catch (ex)
+ {
+ window.opener.OfflineTest.ok(false, "applicationCache.status must not throw an exception");
+ }
+}
+
+applicationCache.onerror = window.opener.OfflineTest.failEvent;
+applicationCache.onupdateready = window.opener.OfflineTest.failEvent;
+applicationCache.onnoupdate = window.opener.OfflineTest.failEvent;
+applicationCache.oncached = window.opener.OfflineTest.priv(manifestUpdated);
+
+</script>
+
+</head>
+
+<body onload="OfflineTest.priv(onLoaded)();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/jupiter.jpg b/dom/tests/mochitest/ajax/offline/jupiter.jpg
new file mode 100644
index 000000000..cddf589d5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/jupiter.jpg
Binary files differ
diff --git a/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs b/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs
new file mode 100644
index 000000000..55326a4cf
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs
@@ -0,0 +1,6 @@
+function handleRequest(request, response)
+{
+ response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
+ response.setHeader("Location", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updating.cacheManifest");
+ response.setHeader("Content-Type", "text/cache-manifest");
+}
diff --git a/dom/tests/mochitest/ajax/offline/missing.html b/dom/tests/mochitest/ajax/offline/missing.html
new file mode 100644
index 000000000..3e4fef759
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/missing.html
@@ -0,0 +1,24 @@
+<html manifest="missing.cacheManifest">
+<head>
+<title>missing test</title>
+<script type="text/javascript">
+
+function obsolete(evt)
+{
+ window.opener.ok(false, "Got an 'obsolete' event");
+ window.opener.finish();
+}
+
+function error(evt) {
+ window.opener.ok(true, "Got an 'error' event");
+ window.opener.finish();
+}
+
+applicationCache.onobsolete = obsolete;
+applicationCache.onerror = error;
+</script>
+</head>
+
+<body>
+<h1></h1>
+</body> </html>
diff --git a/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest
new file mode 100644
index 000000000..4fe7cacfc
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest
@@ -0,0 +1,6 @@
+CACHE MANIFEST
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+# The following item doesn't exist, and will cause an update error.
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/doesntExist.html
diff --git a/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/mochitest.ini b/dom/tests/mochitest/ajax/offline/mochitest.ini
new file mode 100644
index 000000000..961b143b6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/mochitest.ini
@@ -0,0 +1,101 @@
+[DEFAULT]
+skip-if = toolkit == 'android' || e10s #SLOW_DIRECTORY
+support-files =
+ 445544.cacheManifest
+ 445544.cacheManifest^headers^
+ 445544_part1.html
+ 445544_part2.html
+ 460353_iframe_nomanifest.html
+ 460353_iframe_ownmanifest.html
+ 460353_iframe_samemanifest.html
+ 744719-cancel.cacheManifest
+ 744719-cancel.cacheManifest^headers^
+ 744719.cacheManifest
+ 744719.cacheManifest^headers^
+ badManifestMagic.cacheManifest
+ badManifestMagic.cacheManifest^headers^
+ bypass.cacheManifest
+ bypass.cacheManifest^headers^
+ bypass.html
+ changing1Hour.sjs
+ changing1Sec.sjs
+ changingManifest.sjs
+ dynamicRedirect.sjs
+ explicitRedirect.sjs
+ fallback.cacheManifest
+ fallback.cacheManifest^headers^
+ fallback.html
+ fallback2.html
+ fallbackTop.html
+ foreign1.cacheManifest
+ foreign1.cacheManifest^headers^
+ foreign2.cacheManifest
+ foreign2.cacheManifest^headers^
+ foreign2.html
+ jupiter.jpg
+ manifestRedirect.sjs
+ missing.html
+ missingFile.cacheManifest
+ missingFile.cacheManifest^headers^
+ notonwhitelist.html
+ obsolete.html
+ obsoletingManifest.sjs
+ offlineChild.html
+ offlineTests.js
+ onwhitelist.html
+ onwhitelist.html^headers^
+ overlap.cacheManifest
+ overlap.cacheManifest^headers^
+ redirects.sjs
+ simpleManifest.cacheManifest
+ simpleManifest.cacheManifest^headers^
+ subresource744719.html
+ unknownSection.cacheManifest
+ unknownSection.cacheManifest^headers^
+ updatingIframe.sjs
+ updatingImplicit.html
+ updatingManifest.sjs
+ wildcardManifest.cacheManifest
+ wildcardManifest.cacheManifest^headers^
+ namespace1/opp.html
+ namespace1/script.js
+ namespace1/redirectToDifferentOrigin.sjs
+ namespace1/sub/opp.html
+ namespace1/sub/script1.js
+ namespace1/sub2/script2.js
+ namespace2/script3.js
+
+[test_badManifestMagic.html]
+[test_bug445544.html]
+[test_bug460353.html]
+[test_bug474696.html]
+[test_bug544462.html]
+[test_bug744719-cancel.html]
+[test_bug744719.html]
+[test_bug765203.html]
+[test_bypass.html]
+[test_cancelOfflineCache.html]
+[test_changingManifest.html]
+[test_fallback.html]
+[test_foreign.html]
+[test_identicalManifest.html]
+[test_lowDeviceStorage.html]
+[test_lowDeviceStorageDuringUpdate.html]
+[test_missingFile.html]
+[test_missingManifest.html]
+[test_noManifest.html]
+[test_obsolete.html]
+[test_offlineIFrame.html]
+[test_offlineMode.html]
+skip-if = true # disabled due to bug 656943
+[test_overlap.html]
+[test_redirectManifest.html]
+[test_redirectUpdateItem.html]
+[test_refetchManifest.html]
+[test_simpleManifest.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_updateCheck.html]
+[test_updatingManifest.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_xhtmlManifest.xhtml]
+skip-if = toolkit == 'android' #TIMED_OUT
diff --git a/dom/tests/mochitest/ajax/offline/namespace1/opp.html b/dom/tests/mochitest/ajax/offline/namespace1/opp.html
new file mode 100644
index 000000000..daf4abf21
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/namespace1/opp.html
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Falback namespace page 1</title>
+</head>
+
+<body>
+Page in fall back namespace No. 1
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs b/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs
new file mode 100644
index 000000000..22e9e146c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs
@@ -0,0 +1,6 @@
+function handleRequest(request, response)
+{
+ response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
+ response.setHeader("Location", "http://example.org/tests/dom/tests/mochitest/ajax/offline/fallback2.html");
+ response.setHeader("Content-Type", "text/html");
+}
diff --git a/dom/tests/mochitest/ajax/offline/namespace1/script.js b/dom/tests/mochitest/ajax/offline/namespace1/script.js
new file mode 100644
index 000000000..61ffb174f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/namespace1/script.js
@@ -0,0 +1,4 @@
+function scriptNo0Function()
+{
+ return true;
+}
diff --git a/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html b/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html
new file mode 100644
index 000000000..2d0996553
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Falback namespace page 2</title>
+</head>
+
+<body>
+Page in fall back namespace No. 2
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js b/dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js
new file mode 100644
index 000000000..30829316b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/namespace1/sub/script1.js
@@ -0,0 +1,4 @@
+function scriptNo1Function()
+{
+ return true;
+}
diff --git a/dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js b/dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js
new file mode 100644
index 000000000..586d39a19
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/namespace1/sub2/script2.js
@@ -0,0 +1,4 @@
+function scriptNo2Function()
+{
+ return true;
+}
diff --git a/dom/tests/mochitest/ajax/offline/namespace2/script3.js b/dom/tests/mochitest/ajax/offline/namespace2/script3.js
new file mode 100644
index 000000000..20dd8b97d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/namespace2/script3.js
@@ -0,0 +1,4 @@
+function scriptNo3Function()
+{
+ return true;
+}
diff --git a/dom/tests/mochitest/ajax/offline/notonwhitelist.html b/dom/tests/mochitest/ajax/offline/notonwhitelist.html
new file mode 100644
index 000000000..7b61c6843
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/notonwhitelist.html
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Page NOT on whitelist</title>
+
+</head>
+<body onload="parent.notwhitelistOnLoad()">
+Page NOT on whitelist
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/obsolete.html b/dom/tests/mochitest/ajax/offline/obsolete.html
new file mode 100644
index 000000000..5f0106d3a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/obsolete.html
@@ -0,0 +1,69 @@
+<html manifest="obsoletingManifest.sjs">
+<head>
+<title>obsolete test</title>
+<script type="text/javascript">
+
+function obsolete(evt)
+{
+ window.opener.ok(true, "Got an 'obsolete' event");
+
+ // The cache status is switched immediately AFTER sending the event,
+ // make sure that it isn't OBSOLETE yet...
+ window.opener.isnot(applicationCache.status, 5,
+ "Status should not yet be 5 (obsolete)");
+
+ // But check that it is after the event is fired.
+ setTimeout(function(){
+ window.opener.is(applicationCache.status, 5,
+ "Status should be 5 (obsolete)");
+
+ // Now swapCache(), and our new status should be UNCACHED.
+ applicationCache.swapCache();
+ window.opener.is(applicationCache.status, 0,
+ "Status should be 0 (UNCACHED)");
+ window.opener.finish();
+ }, 0);
+}
+
+function fail(evt)
+{
+ window.opener.ok(false, "Got an unexpected event: " + evt.type)
+ window.opener.finish();
+}
+
+applicationCache.oncached = function() {
+ // ok, we've successfully loaded from the initial cache.
+ try {
+ applicationCache.swapCache();
+ window.opener.todo(false, "We shouldn't have to swapCache in the oncached handler (bug 443023)");
+ } catch(e) {
+ }
+
+ // Now delete the manifest and refresh, we should get an "obsolete" message.
+ applicationCache.oncached = fail;
+ applicationCache.onupdateready = fail;
+ applicationCache.onnoupdate = fail;
+ applicationCache.onerror = fail;
+ applicationCache.onobsolete = obsolete;
+
+ // Make the obsoleting.sjs return 404 NOT FOUND code
+ var req = new XMLHttpRequest();
+ req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=");
+ var channel = SpecialPowers.wrap(req).channel
+ .QueryInterface(SpecialPowers.Ci.nsIApplicationCacheChannel);
+ channel.chooseApplicationCache = false;
+ channel.inheritApplicationCache = false;
+ req.send("");
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ applicationCache.update();
+ }
+ }
+}
+
+</script>
+</head>
+
+<body>
+<h1></h1>
+</body> </html>
diff --git a/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs b/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs
new file mode 100644
index 000000000..f53dbeb79
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs
@@ -0,0 +1,31 @@
+var manifest =
+ "CACHE MANIFEST\n" +
+ "obsolete.html\n";
+
+function handleRequest(request, response)
+{
+ var match = request.queryString.match(/^state=(.*)$/);
+ if (match)
+ {
+ response.setStatusLine(request.httpVersion, 204, "No content");
+ response.setHeader("Cache-Control", "no-cache");
+ setState("offline.obsoletingManifest", match[1]);
+ }
+
+ if (request.queryString == "")
+ {
+ switch (getState("offline.obsoletingManifest"))
+ {
+ case "": // The default value
+ response.setStatusLine(request.httpVersion, 404, "Not found");
+ response.setHeader("Cache-Control", "no-cache");
+ break;
+ case "manifestPresent":
+ response.setStatusLine(request.httpVersion, 200, "Ok");
+ response.setHeader("Content-Type", "text/cache-manifest");
+ response.setHeader("Cache-Control", "no-cache");
+ response.write(manifest);
+ break;
+ }
+ }
+}
diff --git a/dom/tests/mochitest/ajax/offline/offlineChild.html b/dom/tests/mochitest/ajax/offline/offlineChild.html
new file mode 100644
index 000000000..d70a060a1
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/offlineChild.html
@@ -0,0 +1,33 @@
+<html>
+<head>
+<title></title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+
+<script type="text/javascript">
+
+// This is called by the parent when the offline update is complete
+// (since we don't get those events)
+function doneLoading()
+{
+ window.parent.childFinished();
+}
+
+if (OfflineTest.setupChild()) {
+ // Child frames shouldn't be receiving cache events.
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.onnoupdate = OfflineTest.failEvent;
+ applicationCache.ondownloading = OfflineTest.failEvent;
+ applicationCache.onprogress = OfflineTest.failEvent;
+ applicationCache.onupdateready = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.failEvent;
+}
+</script>
+
+</head>
+
+<body>
+
+</body> </html>
diff --git a/dom/tests/mochitest/ajax/offline/offlineTests.js b/dom/tests/mochitest/ajax/offline/offlineTests.js
new file mode 100644
index 000000000..f239cd574
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/offlineTests.js
@@ -0,0 +1,436 @@
+// Utility functions for offline tests.
+var Cc = SpecialPowers.Cc;
+var Ci = SpecialPowers.Ci;
+var Cu = SpecialPowers.Cu;
+var LoadContextInfo = Cc["@mozilla.org/load-context-info-factory;1"].getService(Ci.nsILoadContextInfoFactory);
+var CommonUtils = Cu.import("resource://services-common/utils.js", {}).CommonUtils;
+
+const kNetBase = 2152398848; // 0x804B0000
+var NS_ERROR_CACHE_KEY_NOT_FOUND = kNetBase + 61;
+var NS_ERROR_CACHE_KEY_WAIT_FOR_VALIDATION = kNetBase + 64;
+
+// Reading the contents of multiple cache entries asynchronously
+function OfflineCacheContents(urls) {
+ this.urls = urls;
+ this.contents = {};
+}
+
+OfflineCacheContents.prototype = {
+QueryInterface: function(iid) {
+ if (!iid.equals(Ci.nsISupports) &&
+ !iid.equals(Ci.nsICacheEntryOpenCallback)) {
+ throw Cr.NS_ERROR_NO_INTERFACE;
+ }
+ return this;
+ },
+onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
+onCacheEntryAvailable: function(desc, isnew, applicationCache, status) {
+ if (!desc) {
+ this.fetch(this.callback);
+ return;
+ }
+
+ var stream = desc.openInputStream(0);
+ var sstream = Cc["@mozilla.org/scriptableinputstream;1"]
+ .createInstance(SpecialPowers.Ci.nsIScriptableInputStream);
+ sstream.init(stream);
+ this.contents[desc.key] = sstream.read(sstream.available());
+ sstream.close();
+ desc.close();
+ this.fetch(this.callback);
+ },
+
+fetch: function(callback)
+{
+ this.callback = callback;
+ if (this.urls.length == 0) {
+ callback(this.contents);
+ return;
+ }
+
+ var url = this.urls.shift();
+ var self = this;
+
+ var cacheStorage = OfflineTest.getActiveStorage();
+ cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, this);
+}
+};
+
+var OfflineTest = {
+
+_allowedByDefault: false,
+
+_hasSlave: false,
+
+// The window where test results should be sent.
+_masterWindow: null,
+
+// Array of all PUT overrides on the server
+_pathOverrides: [],
+
+// SJSs whom state was changed to be reverted on teardown
+_SJSsStated: [],
+
+setupChild: function()
+{
+ if (this._allowedByDefault) {
+ this._masterWindow = window;
+ return true;
+ }
+
+ if (window.parent.OfflineTest._hasSlave) {
+ return false;
+ }
+
+ this._masterWindow = window.top;
+
+ return true;
+},
+
+/**
+ * Setup the tests. This will reload the current page in a new window
+ * if necessary.
+ *
+ * @return boolean Whether this window is the slave window
+ * to actually run the test in.
+ */
+setup: function()
+{
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
+ try {
+ this._allowedByDefault = SpecialPowers.getBoolPref("offline-apps.allow_by_default");
+ } catch (e) {}
+
+ if (this._allowedByDefault) {
+ this._masterWindow = window;
+
+ return true;
+ }
+
+ if (!window.opener || !window.opener.OfflineTest ||
+ !window.opener.OfflineTest._hasSlave) {
+ // Offline applications must be toplevel windows and have the
+ // offline-app permission. Because we were loaded without the
+ // offline-app permission and (probably) in an iframe, we need to
+ // enable the pref and spawn a new window to perform the actual
+ // tests. It will use this window to report successes and
+ // failures.
+
+ if (SpecialPowers.testPermission("offline-app", Ci.nsIPermissionManager.ALLOW_ACTION, document)) {
+ ok(false, "Previous test failed to clear offline-app permission! Expect failures.");
+ }
+ SpecialPowers.addPermission("offline-app", Ci.nsIPermissionManager.ALLOW_ACTION, document);
+
+ // Tests must run as toplevel windows. Open a slave window to run
+ // the test.
+ this._hasSlave = true;
+ window.open(window.location, "offlinetest");
+
+ return false;
+ }
+
+ this._masterWindow = window.opener;
+
+ return true;
+},
+
+teardownAndFinish: function()
+{
+ this.teardown(function(self) { self.finish(); });
+},
+
+teardown: function(callback)
+{
+ // First wait for any pending scheduled updates to finish
+ this.waitForUpdates(function(self) {
+ // Remove the offline-app permission we gave ourselves.
+
+ SpecialPowers.removePermission("offline-app", window.document);
+
+ // Clear all overrides on the server
+ for (override in self._pathOverrides)
+ self.deleteData(self._pathOverrides[override]);
+ for (statedSJS in self._SJSsStated)
+ self.setSJSState(self._SJSsStated[statedSJS], "");
+
+ self.clear();
+ callback(self);
+ });
+},
+
+finish: function()
+{
+ if (this._allowedByDefault) {
+ SimpleTest.executeSoon(SimpleTest.finish);
+ } else if (this._masterWindow) {
+ // Slave window: pass control back to master window, close itself.
+ this._masterWindow.SimpleTest.executeSoon(this._masterWindow.OfflineTest.finish);
+ window.close();
+ } else {
+ // Master window: finish test.
+ SimpleTest.finish();
+ }
+},
+
+//
+// Mochitest wrappers - These forward tests to the proper mochitest window.
+//
+ok: function(condition, name, diag)
+{
+ return this._masterWindow.SimpleTest.ok(condition, name, diag);
+},
+
+is: function(a, b, name)
+{
+ return this._masterWindow.SimpleTest.is(a, b, name);
+},
+
+isnot: function(a, b, name)
+{
+ return this._masterWindow.SimpleTest.isnot(a, b, name);
+},
+
+todo: function(a, name)
+{
+ return this._masterWindow.SimpleTest.todo(a, name);
+},
+
+clear: function()
+{
+ // XXX: maybe we should just wipe out the entire disk cache.
+ var applicationCache = this.getActiveCache();
+ if (applicationCache) {
+ applicationCache.discard();
+ }
+},
+
+waitForUpdates: function(callback)
+{
+ var self = this;
+ var observer = {
+ notified: false,
+ observe: function(subject, topic, data) {
+ if (subject) {
+ subject.QueryInterface(SpecialPowers.Ci.nsIOfflineCacheUpdate);
+ dump("Update of " + subject.manifestURI.spec + " finished\n");
+ }
+
+ SimpleTest.executeSoon(function() {
+ if (observer.notified) {
+ return;
+ }
+
+ var updateservice = Cc["@mozilla.org/offlinecacheupdate-service;1"]
+ .getService(SpecialPowers.Ci.nsIOfflineCacheUpdateService);
+ var updatesPending = updateservice.numUpdates;
+ if (updatesPending == 0) {
+ try {
+ SpecialPowers.removeObserver(observer, "offline-cache-update-completed");
+ } catch(ex) {}
+ dump("All pending updates done\n");
+ observer.notified = true;
+ callback(self);
+ return;
+ }
+
+ dump("Waiting for " + updateservice.numUpdates + " update(s) to finish\n");
+ });
+ }
+ }
+
+ SpecialPowers.addObserver(observer, "offline-cache-update-completed", false);
+
+ // Call now to check whether there are some updates scheduled
+ observer.observe();
+},
+
+failEvent: function(e)
+{
+ OfflineTest.ok(false, "Unexpected event: " + e.type);
+},
+
+// The offline API as specified has no way to watch the load of a resource
+// added with applicationCache.mozAdd().
+waitForAdd: function(url, onFinished) {
+ // Check every half second for ten seconds.
+ var numChecks = 20;
+
+ var waitForAddListener = {
+ onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
+ onCacheEntryAvailable: function(entry, isnew, applicationCache, status) {
+ if (entry) {
+ entry.close();
+ onFinished();
+ return;
+ }
+
+ if (--numChecks == 0) {
+ onFinished();
+ return;
+ }
+
+ setTimeout(OfflineTest.priv(waitFunc), 500);
+ }
+ };
+
+ var waitFunc = function() {
+ var cacheStorage = OfflineTest.getActiveStorage();
+ cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, waitForAddListener);
+ }
+
+ setTimeout(this.priv(waitFunc), 500);
+},
+
+manifestURL: function(overload)
+{
+ var manifestURLspec;
+ if (overload) {
+ manifestURLspec = overload;
+ } else {
+ var win = window;
+ while (win && !win.document.documentElement.getAttribute("manifest")) {
+ if (win == win.parent)
+ break;
+ win = win.parent;
+ }
+ if (win)
+ manifestURLspec = win.document.documentElement.getAttribute("manifest");
+ }
+
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+
+ var baseURI = ios.newURI(window.location.href, null, null);
+ return ios.newURI(manifestURLspec, null, baseURI);
+},
+
+loadContext: function()
+{
+ return SpecialPowers.wrap(window).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+ .getInterface(SpecialPowers.Ci.nsIWebNavigation)
+ .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+ .getInterface(SpecialPowers.Ci.nsILoadContext);
+},
+
+loadContextInfo: function()
+{
+ return LoadContextInfo.fromLoadContext(this.loadContext(), false);
+},
+
+getActiveCache: function(overload)
+{
+ // Note that this is the current active cache in the cache stack, not the
+ // one associated with this window.
+ var serv = Cc["@mozilla.org/network/application-cache-service;1"]
+ .getService(Ci.nsIApplicationCacheService);
+ var groupID = serv.buildGroupIDForInfo(this.manifestURL(overload), this.loadContextInfo());
+ return serv.getActiveCache(groupID);
+},
+
+getActiveStorage: function()
+{
+ var cache = this.getActiveCache();
+ if (!cache) {
+ return null;
+ }
+
+ var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService);
+ return cacheService.appCacheStorage(LoadContextInfo.default, cache);
+},
+
+priv: function(func)
+{
+ var self = this;
+ return function() {
+ func(arguments);
+ }
+},
+
+checkCacheEntries: function(entries, callback)
+{
+ var checkNextEntry = function() {
+ if (entries.length == 0) {
+ setTimeout(OfflineTest.priv(callback), 0);
+ } else {
+ OfflineTest.checkCache(entries[0][0], entries[0][1], checkNextEntry);
+ entries.shift();
+ }
+ }
+
+ checkNextEntry();
+},
+
+checkCache: function(url, expectEntry, callback)
+{
+ var cacheStorage = this.getActiveStorage();
+ this._checkCache(cacheStorage, url, expectEntry, callback);
+},
+
+_checkCache: function(cacheStorage, url, expectEntry, callback)
+{
+ if (!cacheStorage) {
+ if (expectEntry) {
+ this.ok(false, url + " should exist in the offline cache (no session)");
+ } else {
+ this.ok(true, url + " should not exist in the offline cache (no session)");
+ }
+ if (callback) setTimeout(this.priv(callback), 0);
+ return;
+ }
+
+ var _checkCacheListener = {
+ onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
+ onCacheEntryAvailable: function(entry, isnew, applicationCache, status) {
+ if (entry) {
+ if (expectEntry) {
+ OfflineTest.ok(true, url + " should exist in the offline cache");
+ } else {
+ OfflineTest.ok(false, url + " should not exist in the offline cache");
+ }
+ entry.close();
+ } else {
+ if (status == NS_ERROR_CACHE_KEY_NOT_FOUND) {
+ if (expectEntry) {
+ OfflineTest.ok(false, url + " should exist in the offline cache");
+ } else {
+ OfflineTest.ok(true, url + " should not exist in the offline cache");
+ }
+ } else if (status == NS_ERROR_CACHE_KEY_WAIT_FOR_VALIDATION) {
+ // There was a cache key that we couldn't access yet, that's good enough.
+ if (expectEntry) {
+ OfflineTest.ok(!mustBeValid, url + " should exist in the offline cache");
+ } else {
+ OfflineTest.ok(mustBeValid, url + " should not exist in the offline cache");
+ }
+ } else {
+ OfflineTest.ok(false, "got invalid error for " + url);
+ }
+ }
+ if (callback) setTimeout(OfflineTest.priv(callback), 0);
+ }
+ };
+
+ cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, _checkCacheListener);
+},
+
+setSJSState: function(sjsPath, stateQuery)
+{
+ var client = new XMLHttpRequest();
+ client.open("GET", sjsPath + "?state=" + stateQuery, false);
+
+ var appcachechannel = SpecialPowers.wrap(client).channel.QueryInterface(Ci.nsIApplicationCacheChannel);
+ appcachechannel.chooseApplicationCache = false;
+ appcachechannel.inheritApplicationCache = false;
+ appcachechannel.applicationCache = null;
+
+ client.send();
+
+ if (stateQuery == "")
+ delete this._SJSsStated[sjsPath];
+ else
+ this._SJSsStated.push(sjsPath);
+}
+
+};
diff --git a/dom/tests/mochitest/ajax/offline/onwhitelist.html b/dom/tests/mochitest/ajax/offline/onwhitelist.html
new file mode 100644
index 000000000..9e40cadbf
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/onwhitelist.html
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Page on whitelist</title>
+
+</head>
+<body onload="parent.whitelistOnLoad(1)">
+Page on whitelist
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^ b/dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^
new file mode 100644
index 000000000..9e23c73b7
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/onwhitelist.html^headers^
@@ -0,0 +1 @@
+Cache-Control: no-cache
diff --git a/dom/tests/mochitest/ajax/offline/overlap.cacheManifest b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest
new file mode 100644
index 000000000..e75e48aff
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest
@@ -0,0 +1,12 @@
+CACHE MANIFEST
+
+CACHE:
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+NETWORK:
+bogus/specific/
+
+FALLBACK:
+# Fall back for a bogus namespace
+bogus/ fallback.html
diff --git a/dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^
new file mode 100644
index 000000000..257f2eb60
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest^headers^
@@ -0,0 +1 @@
+Content-Type: text/cache-manifest
diff --git a/dom/tests/mochitest/ajax/offline/redirects.sjs b/dom/tests/mochitest/ajax/offline/redirects.sjs
new file mode 100644
index 000000000..08a300157
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/redirects.sjs
@@ -0,0 +1,52 @@
+ver1manifest =
+ "CACHE MANIFEST\n" +
+ "# v1\n" +
+ "\n" +
+ "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
+
+ver2manifest =
+ "CACHE MANIFEST\n" +
+ "# v2\n" +
+ "\n" +
+ "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
+
+ver3manifest =
+ "CACHE MANIFEST\n" +
+ "# v3\n" +
+ "\n" +
+ "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs";
+
+function handleRequest(request, response)
+{
+ var match = request.queryString.match(/^state=(.*)$/);
+ if (match)
+ {
+ response.setStatusLine(request.httpVersion, 204, "No content");
+ setState("state", match[1]);
+ }
+
+ if (request.queryString == "")
+ {
+ response.setStatusLine(request.httpVersion, 200, "Ok");
+ response.setHeader("Content-Type", "text/cache-manifest");
+ response.setHeader("Cache-Control", "no-cache");
+ switch (getState("state"))
+ {
+ case "": // The default value
+ response.write(ver1manifest + "\n#" + getState("state"));
+ break;
+ case "second":
+ response.write(ver2manifest + "\n#" + getState("state"));
+ break;
+ case "third":
+ response.write(ver3manifest + "\n#" + getState("state"));
+ break;
+ }
+ }
+}
diff --git a/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest
new file mode 100644
index 000000000..aa7bf6335
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest
@@ -0,0 +1,7 @@
+CACHE MANIFEST
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+# The following item is not a valid URI and will be ignored
+bad:/uri/invalid
+
diff --git a/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/subresource744719.html b/dom/tests/mochitest/ajax/offline/subresource744719.html
new file mode 100644
index 000000000..86ba068ec
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/subresource744719.html
@@ -0,0 +1 @@
+<html><body>Dummy subresource</body></html> \ No newline at end of file
diff --git a/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html b/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html
new file mode 100644
index 000000000..f7811bcd5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html
@@ -0,0 +1,53 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest">
+<head>
+<title>bad manifest magic</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gGotChecking = false;
+
+function finishTest() {
+ OfflineTest.teardownAndFinish();
+}
+
+function handleError() {
+ OfflineTest.ok(gGotChecking, "Expected checking event");
+ OfflineTest.ok(true, "Expected error event");
+
+ // These items are listed in the manifest, but the error should have
+ // prevented them from being committed to the cache.
+ var entries = [
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
+ ];
+ OfflineTest.checkCacheEntries(entries, finishTest);
+}
+
+
+if (OfflineTest.setup()) {
+ // Don't expect a bunch of events.
+ applicationCache.ondownloading = OfflineTest.failEvent;
+ applicationCache.onupdateready = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.failEvent;
+ applicationCache.onnoupdate = OfflineTest.failEvent;
+ applicationCache.onprogress = OfflineTest.failEvent;
+
+ // ... but expect 'checking' and 'error'
+ applicationCache.onchecking = function() { gGotChecking = true; };
+ applicationCache.onerror = OfflineTest.priv(handleError);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bug445544.html b/dom/tests/mochitest/ajax/offline/test_bug445544.html
new file mode 100644
index 000000000..07929a656
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug445544.html
@@ -0,0 +1,73 @@
+<html manifest="445544.cacheManifest">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=445544
+-->
+
+<head>
+<title>Test for Bug 445544</title>
+
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+<script type="text/javascript">
+
+var gTestWin;
+var gTimeoutId;
+
+function finish()
+{
+ gTestWin.close();
+ OfflineTest.teardownAndFinish();
+}
+
+function error()
+{
+ OfflineTest.ok(false, "Part 2 did not successfully load.");
+ finish();
+}
+
+function part2loaded()
+{
+ clearTimeout(gTimeoutId);
+ OfflineTest.ok(true, "Part 2 successfully loaded.");
+ finish();
+}
+
+function part1loaded(appCacheStatus)
+{
+ OfflineTest.ok(appCacheStatus > 0,
+ "Part 1 successfully loaded from the application cache.");
+
+ // Loading part 2 (which is not part of that application
+ // cache) should succeed...
+ gTestWin.location = "445544_part2.html";
+
+ // We won't be notified if the page fails to load, fail this test
+ // in 10 seconds.
+ gTimeoutId = setTimeout(error, 10000);
+}
+
+function manifestUpdated()
+{
+ // Open a new window that will be associated with this application
+ // cache. This will call part1loaded().
+ gTestWin = window.open("445544_part1.html");
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bug460353.html b/dom/tests/mochitest/ajax/offline/test_bug460353.html
new file mode 100644
index 000000000..683d53d6a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug460353.html
@@ -0,0 +1,100 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>Bug 460353</title>
+
+<!--
+ This test checks that each iframe creates its own
+ scope. Actually, we just check that it loads and updates
+ its associated cache. There is no check that the cache is the
+ expected one, there is no API to gain that information.
+-->
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+<script class="testbody" type="text/javascript">
+
+var result = new Array();
+var expectedUpdates = 3; // 2 iframes and our self
+
+applicationCache.oncached = onUpdatePassed;
+applicationCache.onnoupdate = onUpdatePassed;
+
+SpecialPowers.pushPermissions([{'type': 'offline-app', 'allow': true, 'context': document}], init);
+
+function onUpdatePassed()
+{
+ if (!(--expectedUpdates))
+ SimpleTest.executeSoon(finish);
+}
+
+function init()
+{
+ var iframes = document.getElementsByTagName('iframe');
+ iframes[0].src = "460353_iframe_nomanifest.html";
+ iframes[1].src = "460353_iframe_ownmanifest.html";
+ iframes[2].src = "460353_iframe_samemanifest.html";
+}
+
+function frameOnLoad(frameid, status)
+{
+ var obj = new Object();
+ result[frameid] = obj;
+
+ result[frameid].load = true;
+ result[frameid].cacheStatus = status;
+}
+
+function frameOnUpdate(frameid, ok, status)
+{
+ result[frameid].update = true;
+ result[frameid].updateOK = ok;
+ result[frameid].cacheStatus = status;
+
+ onUpdatePassed();
+}
+
+function finish()
+{
+ SimpleTest.ok(result["same"].load || false, "Frame with the same manifest loads");
+ SimpleTest.ok(result["same"].update || false, "Frame with the same manifest cache update notification");
+ SimpleTest.ok(result["same"].updateOK || false, "Frame with the same manifest cache update passed OK");
+ SimpleTest.is(result["same"].cacheStatus || -1, 1, "Frame with the same manifest cache status was IDLE");
+
+ SimpleTest.ok(result["diff"].load || false, "Frame with different manifest loads");
+ SimpleTest.ok(result["diff"].update || false, "Frame with different manifest cache update notification");
+ SimpleTest.ok(result["diff"].updateOK || false, "Frame with different manifest cache update passed OK");
+ SimpleTest.is(result["diff"].cacheStatus || -1, 1, "Frame with different manifest cache status was IDLE");
+
+ SimpleTest.ok(result["noman"].load || false, "Frame with no manifest loads");
+ SimpleTest.ok(result["noman"].update == undefined, "Frame with no manifest cache update didn't notify");
+ SimpleTest.ok(result["noman"].updateOK == undefined, "Frame with no manifest cache update didn't pass");
+ SimpleTest.is(result["noman"].cacheStatus || -1, -1, "Frame with no manifest cache status was undefined");
+
+ OfflineTest.waitForUpdates(function() {
+ cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest");
+ cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs");
+
+ SimpleTest.finish();
+ });
+}
+
+function cleanCache(manifestURL)
+{
+ var cache = OfflineTest.getActiveCache(manifestURL);
+ dump("Discarding cache for " + manifestURL + " cache=" + cache + "\n");
+ if (cache)
+ cache.discard();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+<body>
+ <iframe></iframe>
+ <iframe></iframe>
+ <iframe></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bug474696.html b/dom/tests/mochitest/ajax/offline/test_bug474696.html
new file mode 100644
index 000000000..47b0b5202
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug474696.html
@@ -0,0 +1,39 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.cacheManifest">
+<head>
+<title>Fallback on different origin redirect test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+function manifestUpdated()
+{
+ fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs";
+ // Invokes load of fallback.html
+}
+
+function onFallbackLoad(fallbackIdentification)
+{
+ OfflineTest.is(fallbackIdentification, 1, "Got correct fallback for namespace1 (2)");
+
+ applicationCache.onerror = function() {}; // the update invoked by the iframe will finish after we discard the cache, ignore error
+ OfflineTest.teardownAndFinish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.onupdateready = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+</script>
+
+</head>
+
+<body>
+<iframe name="fallbackFrame"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bug544462.html b/dom/tests/mochitest/ajax/offline/test_bug544462.html
new file mode 100644
index 000000000..1dbf9256c
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug544462.html
@@ -0,0 +1,53 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest">
+<head>
+<title>wildcard in network section test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<style>
+ img {
+ max-width: 400px;
+ max-height: 400px;
+ }
+</style>
+
+<script type="text/javascript">
+
+var gImageLoaded = [];
+
+function imageOnLoad(idx)
+{
+ gImageLoaded[idx] = true;
+}
+
+function manifestUpdated()
+{
+ window.location.reload();
+}
+
+function finishTheTest()
+{
+ OfflineTest.is(gImageLoaded[1], true, "Image from a different origin not cointained in the offline cache has loaded");
+ OfflineTest.is(gImageLoaded[2], true, "Image not cointained in the offline cache has loaded");
+ OfflineTest.teardownAndFinish();
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+ applicationCache.onnoupdate = OfflineTest.priv(finishTheTest);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+ <img src="http://example.com/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg" onload="imageOnLoad(1)" />
+ <img src="jupiter.jpg" onload="imageOnLoad(2)" />
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html b/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html
new file mode 100644
index 000000000..53955790d
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html
@@ -0,0 +1,84 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest">
+<head>
+<title>parallel load canceled</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+/*
+ Manifest refers a large number of resource to load. The 10th item however is a reference to a non-existing
+ resource that cancels the load. This test checks we cancel all loads and don't leak any of the other resources
+ after cancelation.
+*/
+
+if (SpecialPowers.isMainProcess()) {
+ ok(applicationCache.mozItems.length == 0,
+ "applicationCache.mozItems should be available and empty before associating with a cache.");
+}
+
+function updateCanceled()
+{
+ OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest", false, null);
+ OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false, null);
+ OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false, null);
+
+ OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/nonexistent744719?010", false, null);
+
+ var URL = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/subresource744719.html?";
+ OfflineTest.checkCache(URL + "001", false, null);
+ OfflineTest.checkCache(URL + "002", false, null);
+ OfflineTest.checkCache(URL + "003", false, null);
+ OfflineTest.checkCache(URL + "004", false, null);
+ OfflineTest.checkCache(URL + "005", false, null);
+ OfflineTest.checkCache(URL + "006", false, null);
+ OfflineTest.checkCache(URL + "007", false, null);
+ OfflineTest.checkCache(URL + "008", false, null);
+ OfflineTest.checkCache(URL + "009", false, null);
+ OfflineTest.checkCache(URL + "011", false, null);
+ OfflineTest.checkCache(URL + "012", false, null);
+ OfflineTest.checkCache(URL + "013", false, null);
+ OfflineTest.checkCache(URL + "014", false, null);
+ OfflineTest.checkCache(URL + "015", false, null);
+ OfflineTest.checkCache(URL + "016", false, null);
+ OfflineTest.checkCache(URL + "017", false, null);
+ OfflineTest.checkCache(URL + "018", false, null);
+ OfflineTest.checkCache(URL + "019", false, null);
+ OfflineTest.checkCache(URL + "020", false, null);
+ OfflineTest.checkCache(URL + "021", false, null);
+ OfflineTest.checkCache(URL + "022", false, null);
+ OfflineTest.checkCache(URL + "023", false, null);
+ OfflineTest.checkCache(URL + "024", false, null);
+ OfflineTest.checkCache(URL + "025", false, null);
+ OfflineTest.checkCache(URL + "026", false, null);
+ OfflineTest.checkCache(URL + "027", false, null);
+ OfflineTest.checkCache(URL + "028", false, null);
+ OfflineTest.checkCache(URL + "029", false, null);
+ OfflineTest.checkCache(URL + "030", false, null);
+
+ OfflineTest.teardownAndFinish();
+}
+
+if (OfflineTest.setup()) {
+ // Wait some time after the update has been canceled to catch potential leaks of channels that would cause
+ // unwanted items to be cached regardless the update has been canceled with a failure.
+ var privUpdateCanceled = OfflineTest.priv(updateCanceled);
+ applicationCache.onerror = function() {window.setTimeout(privUpdateCanceled, 1000)};
+
+ // We don't expect this update to finish correctly.
+ applicationCache.oncached = OfflineTest.failEvent;
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bug744719.html b/dom/tests/mochitest/ajax/offline/test_bug744719.html
new file mode 100644
index 000000000..2c9f5687f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug744719.html
@@ -0,0 +1,76 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719.cacheManifest">
+<head>
+<title>parallel load</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+/*
+ Simply load a large number of resources and check all are properly cached. This should cover all parts
+ of the parallel loading code.
+*/
+
+if (SpecialPowers.isMainProcess()) {
+ ok(applicationCache.mozItems.length == 0,
+ "applicationCache.mozItems should be available and empty before associating with a cache.");
+}
+
+function manifestUpdated()
+{
+ OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719.cacheManifest", true);
+ OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true);
+ OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true);
+
+ var URL = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/subresource744719.html?";
+ OfflineTest.checkCache(URL + "001", true);
+ OfflineTest.checkCache(URL + "002", true);
+ OfflineTest.checkCache(URL + "003", true);
+ OfflineTest.checkCache(URL + "004", true);
+ OfflineTest.checkCache(URL + "005", true);
+ OfflineTest.checkCache(URL + "006", true);
+ OfflineTest.checkCache(URL + "007", true);
+ OfflineTest.checkCache(URL + "008", true);
+ OfflineTest.checkCache(URL + "009", true);
+ OfflineTest.checkCache(URL + "010", true);
+ OfflineTest.checkCache(URL + "011", true);
+ OfflineTest.checkCache(URL + "012", true);
+ OfflineTest.checkCache(URL + "013", true);
+ OfflineTest.checkCache(URL + "014", true);
+ OfflineTest.checkCache(URL + "015", true);
+ OfflineTest.checkCache(URL + "016", true);
+ OfflineTest.checkCache(URL + "017", true);
+ OfflineTest.checkCache(URL + "018", true);
+ OfflineTest.checkCache(URL + "019", true);
+ OfflineTest.checkCache(URL + "020", true);
+ OfflineTest.checkCache(URL + "021", true);
+ OfflineTest.checkCache(URL + "022", true);
+ OfflineTest.checkCache(URL + "023", true);
+ OfflineTest.checkCache(URL + "024", true);
+ OfflineTest.checkCache(URL + "025", true);
+ OfflineTest.checkCache(URL + "026", true);
+ OfflineTest.checkCache(URL + "027", true);
+ OfflineTest.checkCache(URL + "028", true);
+ OfflineTest.checkCache(URL + "029", true);
+ OfflineTest.checkCache(URL + "030", true, function() {
+ OfflineTest.teardownAndFinish();
+ });
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bug765203.html b/dom/tests/mochitest/ajax/offline/test_bug765203.html
new file mode 100644
index 000000000..e55d6d0d5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug765203.html
@@ -0,0 +1,73 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest">
+<head>
+<title>unknown section</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gGotChecking = false;
+var gGotDownloading = false;
+
+function manifestUpdated()
+{
+ OfflineTest.ok(gGotChecking, "Should get a checking event");
+ OfflineTest.ok(gGotDownloading, "Should get a downloading event");
+
+ OfflineTest.is(applicationCache.status, 1, "Cache status should be 1 (CACHED)");
+
+ var entries = [
+ // The manifest itself should be in the cache
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest", true],
+
+ // The document that requested the manifest should be in the cache
+ [window.location.href, true],
+
+ // The entries from the manifest should be in the cache
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
+
+ // The bad entries from the manifest should not be in the cache
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg", false]
+ ];
+ OfflineTest.checkCacheEntries(
+ entries,
+ function() {
+ OfflineTest.teardownAndFinish();
+ });
+}
+
+if (OfflineTest.setup()) {
+ OfflineTest.ok(applicationCache instanceof EventTarget,
+ "applicationCache should be an event target");
+
+ applicationCache.onerror = OfflineTest.failEvent;
+
+ applicationCache.addEventListener("checking", function() {
+ // We should get the "checking" event during an initial update,
+ // but until we are associated it will not affect applicationCache.status
+ OfflineTest.is(applicationCache.status, applicationCache.UNCACHED,
+ "CHECKING state during initial update");
+ gGotChecking = true;
+ }, true);
+ applicationCache.ondownloading = function() {
+ // We should get the "downloading" event during an initial update,
+ // but until we are associated it will not affect applicationCache.status
+ OfflineTest.is(applicationCache.status, applicationCache.UNCACHED,
+ "DOWNLOADING state during initial update")
+ gGotDownloading = true; };
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_bypass.html b/dom/tests/mochitest/ajax/offline/test_bypass.html
new file mode 100644
index 000000000..6ed6e2562
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bypass.html
@@ -0,0 +1,37 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="bypass.cacheManifest">
+<head>
+<title>Bypass test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+/**
+ * This test defines manifest with namespace1/sub2 and namespace2 as bypass
+ * namespaces.
+ * When cache update finishes it loads a test body in an iframe. This iframe
+ * refers four js scripts, some matching the namespace to bypass and some not.
+ * Then checks that just expected scripts loads by calling a method of each
+ * of the script.
+ */
+
+SimpleTest.waitForExplicitFinish();
+
+if (OfflineTest.setup()) {
+ // Load test body when cache update process finished. The test itself
+ // continues at that file.
+ applicationCache.oncached = function()
+ {
+ window.open("bypass.html");
+ }
+}
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html b/dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html
new file mode 100644
index 000000000..6a5c5c5bd
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html
@@ -0,0 +1,58 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>Cancel offline cache</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
+var manifestURI = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newURI(manifest, null, null);
+var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
+ .getService(Ci.nsIOfflineCacheUpdateService);
+
+function manifestCached () {
+ OfflineTest.ok(false, "The update was supposed to be canceled");
+
+ OfflineTest.teardownAndFinish();
+}
+
+function onError () {
+ OfflineTest.ok(true, "Expected error: Update canceled");
+
+ OfflineTest.teardownAndFinish();
+}
+
+function onProgress () {
+ var i = 0;
+ while (i < updateService.numUpdates) {
+ var update = updateService.getUpdate(i);
+ if (update.manifestURI.spec == manifestURI.spec) {
+ update.cancel();
+ return;
+ }
+ i++;
+ }
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.priv(onError);
+ applicationCache.onnoupdate = OfflineTest.failEvent;
+ applicationCache.onprogress = OfflineTest.priv(onProgress);
+ applicationCache.oncached = OfflineTest.priv(manifestCached);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_changingManifest.html b/dom/tests/mochitest/ajax/offline/test_changingManifest.html
new file mode 100644
index 000000000..2ff365a4a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_changingManifest.html
@@ -0,0 +1,116 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changingManifest.sjs">
+<head>
+<title>changing manifest test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gGotChecking = false;
+var gGotDownloading = false;
+
+var g1SecUrl = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changing1Sec.sjs";
+var g1HourUrl = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changing1Hour.sjs";
+
+var gCacheContents = null;
+
+function finish()
+{
+ OfflineTest.teardownAndFinish();
+}
+
+function manifestUpdatedAgain()
+{
+ OfflineTest.ok(gGotChecking, "Should get a checking event on the second update");
+ OfflineTest.ok(gGotDownloading, "Should get a downloading event on the second update");
+
+ // The second manifest has no NETWORK entry, but we are still
+ // associated with the first version of the manifest, so we should
+ // be able to access the whitelisted entry.
+ try {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "onwhitelist.html", false);
+ xhr.send();
+ OfflineTest.ok(true, "Fetched from the initial cache's whitelist.");
+ } catch (e) {
+ OfflineTest.ok(false, "Failed to fetch from the initial cache's whitelist.");
+ }
+
+ // Get the initial contents of the first two files.
+ fetcher = new OfflineCacheContents([g1SecUrl, g1HourUrl]);
+ fetcher.fetch(function(contents) {
+ // Make sure the contents of the 1-second-expiration file have changed,
+ // but that the 1-hour-expiration has not.
+ OfflineTest.isnot(gCacheContents[g1SecUrl], contents[g1SecUrl], "1-second expiration should have changed");
+ OfflineTest.is(gCacheContents[g1HourUrl], contents[g1HourUrl], "1-hour expiration should not have changed");
+
+ finish();
+ });
+}
+
+function failAndFinish(e) {
+ OfflineTest.ok(false, "Unexpected event: " + e.type);
+ finish();
+}
+
+function manifestUpdated()
+{
+ OfflineTest.ok(gGotChecking, "Should get a checking event");
+ OfflineTest.ok(gGotDownloading, "Should get a downloading event");
+
+ // Replace this manifest with a new one.
+ OfflineTest.setSJSState("changingManifest.sjs", "2");
+
+ // Get the initial contents of the first two files.
+ fetcher = new OfflineCacheContents([g1SecUrl, g1HourUrl]);
+ fetcher.fetch(function(contents) {
+ gCacheContents = contents;
+
+ // Now make sure applicationCache.update() does what we expect.
+ applicationCache.onchecking = function() {
+ OfflineTest.is(applicationCache.status, applicationCache.CHECKING,
+ "CHECKING state during update");
+ gGotChecking = true;
+ };
+ applicationCache.ondownloading = function() {
+ OfflineTest.is(applicationCache.status, applicationCache.DOWNLOADING,
+ "DOWNLOADING state during update");
+ gGotDownloading = true;
+ };
+
+ applicationCache.onupdateready = OfflineTest.priv(manifestUpdatedAgain);
+ applicationCache.onnoupdate = failAndFinish;
+ applicationCache.oncached = failAndFinish;
+
+ gGotChecking = false;
+ gGotDownloading = false;
+
+ // The changing versions give out a new version each second,
+ // make sure it has time to grab a new version, and for the
+ // 1-second cache timeout to pass.
+ window.setTimeout("applicationCache.update()", 5000);
+ });
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = failAndFinish;
+ applicationCache.onnoupdate = failAndFinish;
+
+ applicationCache.onchecking = function() { gGotChecking = true; };
+ applicationCache.ondownloading = function() { gGotDownloading = true; };
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_fallback.html b/dom/tests/mochitest/ajax/offline/test_fallback.html
new file mode 100644
index 000000000..8f0fea4ed
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_fallback.html
@@ -0,0 +1,130 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.cacheManifest">
+<head>
+<title>Fallback entry test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+/**
+ * This tests that we fall back to the correct fallback entries when loading
+ * from fallback namespaces listed in the manifest. The test is performed twice
+ * to make sure that no cache entries are created for the nonexistent items."
+ * That would lead to a failure to fallback, as there would always be an entry
+ * in the application cache.
+ */
+
+var gStep = 1;
+var gChildLoad = false;
+var gTopWindow = null;
+
+function manifestUpdated()
+{
+ fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html";
+ // Invokes load of fallback.html
+}
+
+function onFallbackLoad(fallbackIdentification)
+{
+ switch (gStep)
+ {
+ case 001:
+ OfflineTest.ok(!gChildLoad, "offline child not load before cache update");
+ gChildLoad = true;
+ // no break
+ case 101:
+ OfflineTest.is(fallbackIdentification, 1, "fallback for namespace1/ in step " + gStep);
+
+ fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub-non-existing.html";
+ // Invokes load of fallback.html
+ break;
+
+ case 002:
+ case 102:
+ OfflineTest.is(fallbackIdentification, 1, "fallback for namespace1/, sub namespace in name of the frame in step " + gStep);
+
+ fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html";
+ // Invokes load of fallback2.html
+ break;
+
+ case 003:
+ case 103:
+ OfflineTest.is(fallbackIdentification, 2, "fallback for namespace1/sub/ in step " + gStep);
+
+ fallbackFrame.location = "HTTP://MOCHI.TEST:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html";
+ // Invokes load of fallback2.html
+ break;
+
+ case 004:
+ case 104:
+ OfflineTest.is(fallbackIdentification, 2, "fallback for namespace1/sub/ in step " + gStep);
+
+ // Try opening a non-existing page as a top level document. It must
+ // fall to fallbackTop.html that identifies it self as '100'.
+ // Invokes load of fallbackTop.html
+ gTopWindow = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace2/non-existing.html");
+
+ break;
+
+ case 005:
+ // Try all over again. This checks there are no entries for non-existing
+ // pages created/leaked. That would prevent fallback load.
+ gStep = 100;
+
+ fallbackFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html";
+ // Invokes load of fallback1.html, again, from the start
+ // no break
+ case 105:
+ OfflineTest.is(fallbackIdentification, 100, "fallback for namespace2/, invoked by a top level document " + gStep);
+
+ gTopWindow.close();
+ gTopWindow = null;
+
+ break;
+ }
+
+ if (gStep == 105) {
+ finalize();
+ return;
+ }
+
+ ++gStep;
+}
+
+
+function finishTest()
+{
+ OfflineTest.teardownAndFinish();
+}
+
+function finalize()
+{
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
+ var entries = [
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub-non-existing.html", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/non-existing.html", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace2/non-existing.html", false]
+ ];
+ OfflineTest.checkCacheEntries(entries, finishTest);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.onupdateready = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+</script>
+
+</head>
+
+<body>
+<iframe name="fallbackFrame" src=""></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_foreign.html b/dom/tests/mochitest/ajax/offline/test_foreign.html
new file mode 100644
index 000000000..cb55995e2
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_foreign.html
@@ -0,0 +1,59 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest">
+<head>
+<title>Foreign test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+/**
+ * This test loads a manifest that contains as an explicit entry
+ * foreign2.html page. After manifest is cached and presence of the
+ * foreign2.html page is checked we redirect to foreign2.html
+ * page. Then the test continues inside that page as follows:
+ * On load of foreign2.html we check there is no associated cache
+ * because the foreign2.html page was marked as FOREIGN in foreign1 cache.
+ * After the foreign2 manifest is updated we check foreign2 cache is
+ * chosen by foreign.html page.
+ */
+
+var win;
+
+function manifestUpdated()
+{
+ var appCacheService = SpecialPowers.Cc["@mozilla.org/network/application-cache-service;1"]
+ .getService(SpecialPowers.Ci.nsIApplicationCacheService);
+
+ foreign1cache = appCacheService.chooseApplicationCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo());
+
+ OfflineTest.ok(foreign1cache, "foreign2.html chosen from foreign1 cache");
+ OfflineTest.is(foreign1cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest")
+
+ win = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html");
+}
+
+function onDone() // called by the open window after stuff is finished
+{
+ win.close();
+ OfflineTest.teardownAndFinish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.onupdateready = OfflineTest.failEvent;
+ applicationCache.onnoupdate = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_identicalManifest.html b/dom/tests/mochitest/ajax/offline/test_identicalManifest.html
new file mode 100644
index 000000000..6e8f4835e
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_identicalManifest.html
@@ -0,0 +1,86 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>identical manifest test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gGotChecking = false;
+var gGotDownloading = false;
+
+function finishTest()
+{
+ OfflineTest.teardownAndFinish();
+}
+
+function noUpdate()
+{
+ OfflineTest.ok(gGotChecking, "Should get a checking event");
+ OfflineTest.ok(!gGotDownloading, "Should not get a downloading event");
+
+ var entries = [
+ // The document that requested the manifest should be in the cache
+ [window.location.href, true],
+
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true]
+ ];
+ OfflineTest.checkCacheEntries(entries, finishTest);
+}
+
+function manifestUpdated()
+{
+ OfflineTest.ok(gGotChecking, "Should get a checking event");
+ OfflineTest.ok(gGotDownloading, "Should get a downloading event");
+
+ var entries = [
+ // The manifest itself should be in the cache
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
+
+ // The document that requested the manifest should be in the cache
+ [window.location.href, true],
+
+ // The entries from the manifest should be in the cache
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
+
+ // The bad entries from the manifest should not be in the cache
+ ["bad:/uri/invalid", false]
+ ];
+ OfflineTest.checkCacheEntries(entries, manifestUpdatedContinue);
+}
+
+function manifestUpdatedContinue()
+{
+ // Now make sure applicationCache.update() does what we expect.
+ applicationCache.oncached = OfflineTest.failEvent;
+ applicationCache.onnoupdate = OfflineTest.priv(noUpdate);
+
+ gGotChecking = false;
+ gGotDownloading = false;
+ applicationCache.update();
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.onnoupdate = OfflineTest.failEvent;
+ applicationCache.onudpateready = OfflineTest.failEvent;
+
+ applicationCache.onchecking = function() { gGotChecking = true; };
+ applicationCache.ondownloading = function() { gGotDownloading = true; };
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html
new file mode 100644
index 000000000..d03ef5a12
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html
@@ -0,0 +1,91 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Low device storage</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+/**
+ * This test checks that an offline cache update scheduled *after* a low device
+ * storage situation appears is canceled. It basically does:
+ *
+ * 1. Notifies to the offline cache update service about a fake
+ * low device storage situation.
+ * 2. Schedules an update and observes for its notifications.
+ * 3. We are supposed to receive an error event notifying about the cancelation
+ * of the update because of the low storage situation.
+ * 4. Notifies to the offline cache update service that we've recovered from
+ * the low storage situation.
+ */
+
+var updateService = SpecialPowers.Cc['@mozilla.org/offlinecacheupdate-service;1']
+ .getService(Ci.nsIOfflineCacheUpdateService);
+
+var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
+ .getService(SpecialPowers.Ci.nsIObserverService);
+
+var errorReceived = false;
+
+var systemPrincipal = SpecialPowers.Services.scriptSecurityManager.getSystemPrincipal();
+
+function finish() {
+ obs.notifyObservers(updateService, "disk-space-watcher", "free");
+
+ OfflineTest.teardownAndFinish();
+}
+
+if (OfflineTest.setup()) {
+ obs.notifyObservers(updateService, "disk-space-watcher", "full");
+
+ var updateObserver = {
+ updateStateChanged: function (aUpdate, aState) {
+ switch(aState) {
+ case Ci.nsIOfflineCacheUpdateObserver.STATE_ERROR:
+ errorReceived = true;
+ OfflineTest.ok(true, "Expected error. Update canceled");
+ break;
+ case Ci.nsIOfflineCacheUpdateObserver.STATE_FINISHED:
+ aUpdate.removeObserver(this);
+ OfflineTest.ok(errorReceived,
+ "Finished after receiving the expected error");
+ finish();
+ break;
+ case Ci.nsIOfflineCacheUpdateObserver.STATE_NOUPDATE:
+ aUpdate.removeObserver(this);
+ OfflineTest.ok(false, "No update");
+ finish();
+ break;
+ case Ci.nsIOfflineCacheUpdateObserver.STATE_DOWNLOADING:
+ case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMSTARTED:
+ case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMPROGRESS:
+ aUpdate.removeObserver(this);
+ OfflineTest.ok(false, "The update was supposed to be canceled");
+ finish();
+ break;
+ }
+ },
+ applicationCacheAvailable: function() {}
+ };
+
+ var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ var manifestURI = ioService.newURI(manifest, null, null);
+ var documentURI = ioService.newURI(document.documentURI, null, null);
+ var update = updateService.scheduleUpdate(manifestURI, documentURI, systemPrincipal, window);
+ update.addObserver(updateObserver, false);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html
new file mode 100644
index 000000000..88a0b4eae
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html
@@ -0,0 +1,58 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>Low device storage during update</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+/**
+ * This test checks that an offline cache update is canceled when a low device
+ * storage condition is detected during the update.
+ */
+
+var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
+ .getService(Ci.nsIOfflineCacheUpdateService);
+
+var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
+ .getService(SpecialPowers.Ci.nsIObserverService);
+
+function finish() {
+ obs.notifyObservers(updateService, "disk-space-watcher", "free");
+
+ OfflineTest.teardownAndFinish();
+}
+
+function onError() {
+ OfflineTest.ok(true, "Expected error: Update canceled");
+ finish();
+}
+
+function onUnexpectedEvent() {
+ OfflineTest.ok(false, "The update was supposed to be canceled");
+ finish();
+}
+
+function onChecking() {
+ obs.notifyObservers(updateService, "disk-space-watcher", "full");
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.priv(onError);
+ applicationCache.onprogress = OfflineTest.priv(onUnexpectedEvent);
+ applicationCache.oncached = OfflineTest.priv(onUnexpectedEvent);
+ applicationCache.onchecking = OfflineTest.priv(onChecking);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_missingFile.html b/dom/tests/mochitest/ajax/offline/test_missingFile.html
new file mode 100644
index 000000000..4a17dee28
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_missingFile.html
@@ -0,0 +1,53 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest">
+<head>
+<title>missing manifest file test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gGotChecking = false;
+var gGotDownloading = false;
+
+function finishTest() {
+ OfflineTest.teardownAndFinish();
+}
+
+function handleError() {
+ OfflineTest.ok(gGotChecking, "Expected checking event");
+ OfflineTest.ok(gGotDownloading, "Expected downloading event");
+ OfflineTest.ok(true, "Expected error event");
+
+ // These items are listed in the manifest, but the error should have
+ // prevented them from being committed to the cache.
+ var entries = [
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
+ ];
+ OfflineTest.checkCacheEntries(entries, finishTest);
+}
+
+if (OfflineTest.setup()) {
+ // Don't expect any "success" events.
+ applicationCache.onupdateready = function() { OfflineTest.failEvent("updateready"); }
+ applicationCache.oncached = function() { OfflineTest.failEvent("cached"); }
+ applicationCache.onnoupdate = function() { OfflineTest.failEvent("noupdate"); }
+
+ applicationCache.ondownloading = function() { gGotDownloading = true; };
+ applicationCache.onchecking = function() { gGotChecking = true; };
+ applicationCache.onerror = OfflineTest.priv(handleError);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_missingManifest.html b/dom/tests/mochitest/ajax/offline/test_missingManifest.html
new file mode 100644
index 000000000..1d7bc83ec
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_missingManifest.html
@@ -0,0 +1,33 @@
+<html>
+<head>
+<title>Test missing manifest</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gTestWin;
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPermissions([{'type': 'offline-app', 'allow': true, 'context': document}], startTest);
+
+function startTest() {
+ // now this will properly load the manifest.
+ gTestWin = window.open("missing.html");
+}
+
+function finish() {
+ gTestWin.close();
+ SimpleTest.finish();
+}
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_noManifest.html b/dom/tests/mochitest/ajax/offline/test_noManifest.html
new file mode 100644
index 000000000..5f9becf83
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_noManifest.html
@@ -0,0 +1,43 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>bad manifest content type</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function expectInvalidState(fn, desc) {
+ var gotInvalidState = false;
+ try {
+ fn();
+ } catch(e) {
+ if (e.name == "InvalidStateError" &&
+ e.code == DOMException.INVALID_STATE_ERR) {
+ gotInvalidState = true;
+ }
+ }
+
+ ok(gotInvalidState, desc);
+}
+
+is(typeof(applicationCache), "object");
+if (SpecialPowers.isMainProcess()) {
+ is(applicationCache.mozLength, 0, "applicationCache.mozLength should be 0");
+}
+is(applicationCache.status, 0, "applicationCache.status should be 0 (UNCACHED)");
+
+expectInvalidState(function() { applicationCache.update(); },
+ "applicationCache.update should throw InvalidStateError");
+expectInvalidState(function() { applicationCache.swapCache(); },
+ "applicationCache.update should throw InvalidStateError");
+
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_obsolete.html b/dom/tests/mochitest/ajax/offline/test_obsolete.html
new file mode 100644
index 000000000..b3d9d76ba
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_obsolete.html
@@ -0,0 +1,42 @@
+<html>
+<head>
+<title>Test obsolete application caches</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gTestWin;
+
+SpecialPowers.pushPermissions([{'type': 'offline-app', 'allow': true, 'context': document}], startTest);
+
+function startTest() {
+ // Make the obsoleting.sjs return a valid manifest
+ var req = new XMLHttpRequest();
+ req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=manifestPresent");
+ req.setRequestHeader("Content-Type", "text/cache-manifest");
+ req.send("");
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ // now this will properly load the manifest.
+ gTestWin = window.open("obsolete.html");
+ }
+ }
+}
+
+function finish() {
+ gTestWin.close();
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_offlineIFrame.html b/dom/tests/mochitest/ajax/offline/test_offlineIFrame.html
new file mode 100644
index 000000000..35ca20683
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_offlineIFrame.html
@@ -0,0 +1,46 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>offline iframe test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+
+function checkEntries() {
+ var entries = [
+ // The manifest itself should be in the cache
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
+
+ // The entries from the manifest should be in the cache
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true]
+ ];
+ OfflineTest.checkCacheEntries(entries, function() { window.frames["offlineChild"].doneLoading(); });
+}
+
+function childFinished()
+{
+ OfflineTest.teardownAndFinish();
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+
+ applicationCache.oncached = OfflineTest.priv(checkEntries);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+<iframe name="offlineChild" src="offlineChild.html"></iframe>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_offlineMode.html b/dom/tests/mochitest/ajax/offline/test_offlineMode.html
new file mode 100644
index 000000000..1d4610fb5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_offlineMode.html
@@ -0,0 +1,164 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
+<head>
+<title>Offline mode test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+/**
+ * The test loads a manifest and cache it.
+ * Then tests if all works in online mode
+ * as expected. Then switches firefox to offline
+ * mode and tries the page load still works as
+ * expected, i.e. all items from the cache load.
+ */
+
+var gImplicitWindow = null;
+var gCompleteTimeout = null;
+var gGotExplicitVersion = 0;
+var gGotImplicitVersion = 0;
+var gGotDynamicVersion = 0;
+var gGotOnError = false;
+
+function createURI(urispec)
+{
+ var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+ return ioServ.newURI(urispec, null, null);
+}
+
+// test
+
+function manifestUpdated()
+{
+ applicationCache.mozAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html");
+ OfflineTest.waitForAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html", dynamicAdded);
+}
+
+function dynamicAdded()
+{
+ aFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html";
+}
+
+// Called by the dynamically added iframe on load
+function notwhitelistOnLoad()
+{
+ gGotDynamicVersion = 1;
+ aFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs";
+}
+
+// Called by the explicit iframe on load
+function frameLoad(version)
+{
+ gGotExplicitVersion = version;
+ gImplicitWindow = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html");
+}
+
+// Called by the implicit window on load
+function implicitLoaded(aWindow, errorOccured)
+{
+ aWindow.close();
+
+ gGotImplicitVersion = 1;
+ OfflineTest.waitForAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", implicitAdded);
+}
+
+function implicitAdded()
+{
+ OfflineTest.priv(finalize)();
+}
+
+function finalize()
+{
+ window.clearTimeout(gCompleteTimeout);
+
+ var ioserv = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+
+ if (!ioserv.offline)
+ {
+ OfflineTest.is(gGotExplicitVersion, 1, "Explicit entry loaded");
+ OfflineTest.is(gGotImplicitVersion, 1, "Implicit entry loaded");
+ OfflineTest.is(gGotDynamicVersion, 1, "Dynamic entry loaded");
+
+ gGotExplicitVersion = 0;
+ gGotImplicitVersion = 0;
+ gGotDynamicVersion = 0;
+
+ var entries = [
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true]
+ ];
+ OfflineTest.checkCacheEntries(entries, goOffline);
+ }
+ else
+ {
+ gImplicitWindow.close();
+
+ ioserv.offline = false;
+
+ OfflineTest.is(gGotExplicitVersion, 1, "Explicit entry loaded");
+ OfflineTest.is(gGotImplicitVersion, 1, "Bug 461325 - Implicit entry loaded");
+ OfflineTest.is(gGotDynamicVersion, 1, "Dynamic entry loaded");
+ OfflineTest.ok(gGotOnError, "Got onerror event invoked by implicit page load in offline mode");
+
+ OfflineTest.teardownAndFinish();
+ }
+}
+
+function goOffline()
+{
+ var listener = {
+ onCacheEntryDoomed: function (status) {
+ OfflineTest.priv(goOfflineContinue)();
+ }
+ };
+
+ // Delete HTTP cache to ensure we are going from offline cache
+ var cache = Cc["@mozilla.org/network/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService);
+ var storage = cache.diskCacheStorage(LoadContextInfo.default, false);
+ storage.asyncDoomURI(createURI("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html"), "", null);
+ storage.asyncDoomURI(createURI("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs"), "", null);
+ storage.asyncDoomURI(createURI("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html"), "", listener);
+}
+
+function goOfflineContinue()
+{
+ var ioserv = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+
+ ioserv.offline = true;
+
+ gCompleteTimeout = window.setTimeout(OfflineTest.priv(finalize), 10000);
+
+ // remove error handling. in offline mode
+ // is correct to get error message
+ applicationCache.onerror = function() {gGotOnError = true;}
+
+ aFrame.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/notonwhitelist.html";
+ // Starts the chain all over again but in offline mode.
+}
+
+SimpleTest.waitForExplicitFinish();
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.onupdateready = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+</script>
+
+</head>
+
+<body>
+
+<iframe name="aFrame" src=""></iframe>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_overlap.html b/dom/tests/mochitest/ajax/offline/test_overlap.html
new file mode 100644
index 000000000..3dddf16e9
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_overlap.html
@@ -0,0 +1,35 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/overlap.cacheManifest">
+<head>
+<title>overlapping namespaces test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function manifestUpdated()
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "bogus/specific/test.html", false);
+ xhr.send();
+
+ OfflineTest.is(xhr.status, 200, "Should have fallen back.");
+ OfflineTest.teardownAndFinish();
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_redirectManifest.html b/dom/tests/mochitest/ajax/offline/test_redirectManifest.html
new file mode 100644
index 000000000..95627e361
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_redirectManifest.html
@@ -0,0 +1,44 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs">
+<head>
+<title>Fail update on manifest redirection test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+/**
+ */
+
+function manifestCached()
+{
+ OfflineTests.ok(false, "Manifest must not be cached");
+ finish();
+}
+
+function manifestError()
+{
+ OfflineTest.ok(true, "Error expected");
+ finish();
+}
+
+function finish()
+{
+ OfflineTest.teardownAndFinish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.priv(manifestError);
+ applicationCache.oncached = OfflineTest.priv(manifestCached);
+}
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html b/dom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html
new file mode 100755
index 000000000..a646b33e4
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_redirectUpdateItem.html
@@ -0,0 +1,137 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/redirects.sjs">
+<head>
+<title>Entries redirection handling during update test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+var gCurrentManifestVersion = 1;
+
+function manifestCached()
+{
+ var entries = [
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs", true],
+ ];
+ OfflineTest.checkCacheEntries(entries, manifestCachedContinue);
+}
+
+function manifestCachedContinue()
+{
+ OfflineTest.is(gCurrentManifestVersion, 1, "Cached event for manifest version one");
+
+ // Now add one dynamic entry (now with content overriden redirect sjs)
+ applicationCache.mozAdd(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs");
+
+ // Wait for the dynamic entry be added to the cache...
+ OfflineTest.waitForAdd(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
+ function() {
+ // ...check it is there...
+ OfflineTest.checkCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
+ true,
+ function() {
+ // ...revert state of the dynamic entry on the server, now we get the redirect...
+ OfflineTest.setSJSState(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
+ "");
+
+ // ...update manifest to the new version on the server...
+ OfflineTest.setSJSState(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/redirects.sjs",
+ "second");
+ gCurrentManifestVersion = 2;
+
+ // ...and finally invoke the cache update.
+ applicationCache.update();
+ });
+ });
+}
+
+function manifestUpdated()
+{
+ switch (gCurrentManifestVersion)
+ {
+ case 2:
+ // Check the dynamic entry was removed from the cache (because of the redirect)...
+ OfflineTest.checkCache(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
+ false,
+ function () {
+ // ...return back redirect for the explicit entry...
+ OfflineTest.setSJSState(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs",
+ "");
+
+ // ...update the manifest to the third version...
+ OfflineTest.setSJSState(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/redirects.sjs",
+ "third");
+ gCurrentManifestVersion = 3;
+
+ // ...and invoke the cache update, now we must get error.
+ applicationCache.update();
+ });
+
+ break;
+
+ case 3:
+ OfflineTest.ok(false, "Update didn't fail for third version of the manifest");
+ finish();
+ break;
+ }
+}
+
+function manifestError()
+{
+ switch (gCurrentManifestVersion)
+ {
+ case 1:
+ OfflineTest.ok(false, "Error not expected when caching the first version of the manifest");
+ finish();
+ break;
+ case 2:
+ OfflineTest.ok(false, "Error not expected when updating to second version of the manifest");
+ finish();
+ break;
+ case 3:
+ OfflineTest.ok(true, "Error expected when updating to third version of the manifest");
+ finish();
+ break;
+ }
+}
+
+function finish()
+{
+ OfflineTest.teardownAndFinish();
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.priv(manifestError);
+ applicationCache.onupdateready = OfflineTest.priv(manifestUpdated);
+ applicationCache.oncached = OfflineTest.priv(manifestCached);
+
+ // Override sjs redirects on the server, it will now return 200 OK and the content
+ OfflineTest.setSJSState(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs",
+ "on");
+ OfflineTest.setSJSState(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs",
+ "on");
+}
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_refetchManifest.html b/dom/tests/mochitest/ajax/offline/test_refetchManifest.html
new file mode 100644
index 000000000..a7205b73f
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_refetchManifest.html
@@ -0,0 +1,88 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changingManifest.sjs">
+<head>
+<title>refetch manifest test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+<script type="text/javascript">
+
+function finish()
+{
+ OfflineTest.teardownAndFinish();
+}
+
+function failAndFinish(e)
+{
+ OfflineTest.ok(false, "Unexpected event: " + e.type);
+ finish();
+}
+
+function manifestUpdated()
+{
+ // Replace this manifest with a new one.
+
+ // XXX: After this put, we will no longer have Cache-Control:
+ // no-cache on the manifest, so future updates will just use the
+ // cached manifest.
+
+ // Get the initial contents of the first two files.
+ fetcher = new OfflineCacheContents([g1SecUrl, g1HourUrl]);
+ fetcher.fetch(function(contents) {
+ gCacheContents = contents;
+
+ // Now make sure applicationCache.update() does what we expect.
+ applicationCache.onupdateready = OfflineTest.priv(manifestUpdatedAgain);
+ applicationCache.onnoupdate = failAndFinish;
+ applicationCache.oncached = failAndFinish;
+
+ gGotChecking = false;
+ gGotDownloading = false;
+
+ // The changing versions give out a new version each second,
+ // make sure it has time to grab a new version, and for the
+ // 1-second cache timeout to pass.
+ window.setTimeout("applicationCache.update()", 5000);
+ });
+}
+
+function replaceManifest()
+{
+ // If we replace the manifest after a downloading event, the update
+ // should fail when it revalidates the manifest at the end of the update.
+ OfflineTest.setSJSState("changingManifest.sjs", "2");
+}
+
+function cached()
+{
+ OfflineTest.ok(true, "Got the expected cached event.");
+ finish();
+}
+
+function gotError()
+{
+ OfflineTest.ok(true, "Got the expected error event.");
+
+ // Now this update will be rescheduled, and it should succeed.
+ applicationCache.onerror = failAndFinish;
+ applicationCache.oncached = cached;
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = gotError;
+ applicationCache.onnoupdate = failAndFinish;
+
+ applicationCache.ondownloading = replaceManifest;
+ applicationCache.oncached = failAndFinish;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_simpleManifest.html b/dom/tests/mochitest/ajax/offline/test_simpleManifest.html
new file mode 100644
index 000000000..508bcb516
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_simpleManifest.html
@@ -0,0 +1,130 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>simple manifest test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var gGotChecking = false;
+var gGotDownloading = false;
+
+ok(applicationCache.mozItems.length == 0,
+ "applicationCache.mozItems should be available and empty before associating with a cache.");
+
+function addFinished()
+{
+ OfflineTest.ok(applicationCache.mozLength == 1, "applicationCache should have one dynamic entry (deprecated API)");
+ OfflineTest.ok(applicationCache.mozItem(0) == "http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
+ "applicationCache's dynamic entry should be the one we expect (deprecated API)");
+
+ OfflineTest.ok(applicationCache.mozItems.length == 1, "applicationCache should have one dynamic entry");
+ OfflineTest.ok(applicationCache.mozItems[0] == "http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
+ "applicationCache's dynamic entry should be the one we expect");
+
+ OfflineTest.ok(applicationCache.mozHasItem("http://mochi.test:8888/tests/SimpleTest/EventUtils.js"),
+ "applicationCache.mozHasItem() should see the dynamic entry");
+
+ // Check that the entry was added successfully
+ OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
+ true,
+ removeItem);
+}
+
+function removeItem()
+{
+ // Now test that removes work
+ applicationCache.mozRemove("http://mochi.test:8888/tests/SimpleTest/EventUtils.js");
+
+ OfflineTest.ok(applicationCache.mozLength == 0,
+ "applicationCache should have no dynamic entries (deprecated API)");
+ OfflineTest.ok(applicationCache.mozItems.length == 0,
+ "applicationCache should have no dynamic entries");
+ OfflineTest.ok(!applicationCache.mozHasItem("http://mochi.test:8888/tests/SimpleTest/EventUtils.js"),
+ "applicationCache.mozHasItem() should not see the removed dynamic entry");
+
+ OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
+ false,
+ function() {
+ // We're done
+ OfflineTest.teardownAndFinish();
+ });
+}
+
+function manifestUpdated()
+{
+ OfflineTest.ok(gGotChecking, "Should get a checking event");
+ OfflineTest.ok(gGotDownloading, "Should get a downloading event");
+
+ OfflineTest.is(applicationCache.status, 1, "Cache status should be 1 (CACHED)");
+
+ var entries = [
+ // The manifest itself should be in the cache
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true],
+
+ // The document that requested the manifest should be in the cache
+ [window.location.href, true],
+
+ // The entries from the manifest should be in the cache
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
+
+ // The bad entries from the manifest should not be in the cache
+ ["bad:/uri/invalid", false]
+ ];
+ OfflineTest.checkCacheEntries(
+ entries,
+ function() {
+ try {
+ applicationCache.swapCache();
+ OfflineTest.ok(false, "application.swapCache() should fail after initial update.");
+ } catch(ex) {
+ OfflineTest.ok(true, "application.swapCache() should fail after initial update.");
+ }
+
+ // XXX: make sure that the previous version went away after the swapCache().
+
+ // Now add a file using the applicationCache API
+ applicationCache.mozAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js");
+
+ // Wait for the add() to be downloaded
+ OfflineTest.waitForAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
+ OfflineTest.priv(addFinished));
+ });
+}
+
+if (OfflineTest.setup()) {
+ OfflineTest.ok(applicationCache instanceof EventTarget,
+ "applicationCache should be an event target");
+
+ applicationCache.onerror = OfflineTest.failEvent;
+
+ applicationCache.addEventListener("checking", function() {
+ // We should get the "checking" event during an initial update,
+ // but until we are associated it will not affect applicationCache.status
+ OfflineTest.is(applicationCache.status, applicationCache.UNCACHED,
+ "CHECKING state during initial update");
+ gGotChecking = true;
+ }, true);
+ applicationCache.ondownloading = function() {
+ // We should get the "downloading" event during an initial update,
+ // but until we are associated it will not affect applicationCache.status
+ OfflineTest.is(applicationCache.status, applicationCache.UNCACHED,
+ "DOWNLOADING state during initial update")
+ gGotDownloading = true; };
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_updateCheck.html b/dom/tests/mochitest/ajax/offline/test_updateCheck.html
new file mode 100644
index 000000000..1f0634cba
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_updateCheck.html
@@ -0,0 +1,87 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
+<head>
+<title>Cache update test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+/*
+ * The test is checking nsIOfflineCacheUpdateService.checkForUpdate API:
+ * - cache a manifest
+ * - check for an update of it, expected is "no update avail"
+ * - modify the manifest on the server
+ * - check for an update again, expected is "update avail"
+ * - check for an update ones again, expected is "update avail" (secondary check to probe
+ * we didn't screw state of the manifest in the current cache with the first check)
+ * - cache the modified manifest, new version is now in the cache
+ * - last check for an update, expected is "no update avail" again
+ */
+
+SimpleTest.waitForExplicitFinish();
+
+var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs";
+var manifestURI = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newURI(manifest, null, null);
+var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
+ .getService(Ci.nsIOfflineCacheUpdateService);
+
+var systemPrincipal = SpecialPowers.Services.scriptSecurityManager.getSystemPrincipal();
+
+function manifestCached()
+{
+ // Run first check for an update
+ updateService.checkForUpdate(manifestURI, systemPrincipal, {
+ observe: function(subject, topic, data) {
+ OfflineTest.is(topic, "offline-cache-update-unavailable", "No update avail");
+
+ // Change the manifest content
+ OfflineTest.setSJSState(manifest, "second");
+
+ // Check we now get notification on update ready
+ updateService.checkForUpdate(manifestURI, systemPrincipal, {
+ observe: function(subject, topic, data) {
+ OfflineTest.is(topic, "offline-cache-update-available", "Update avail (1)");
+
+ // Do the check again. We must get the same result. Double check is here
+ // to make sure we don't overwrite any data in the cache by the check it self.
+ updateService.checkForUpdate(manifestURI, systemPrincipal, {
+ observe: function(subject, topic, data) {
+ OfflineTest.is(topic, "offline-cache-update-available", "Update avail (2)");
+
+ // Update the manifest, invokes manifestUpdated()
+ applicationCache.onupdateready = OfflineTest.priv(manifestUpdated);
+ applicationCache.update();
+ }
+ });
+ }
+ });
+ }
+ });
+}
+
+function manifestUpdated()
+{
+ // Check for an update after manifest has been updated
+ updateService.checkForUpdate(manifestURI, systemPrincipal, {
+ observe: function(subject, topic, data) {
+ OfflineTest.is(topic, "offline-cache-update-unavailable", "No update avail (2)");
+
+ OfflineTest.teardownAndFinish();
+ }
+ });
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestCached);
+}
+
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_updatingManifest.html b/dom/tests/mochitest/ajax/offline/test_updatingManifest.html
new file mode 100644
index 000000000..6d573a926
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_updatingManifest.html
@@ -0,0 +1,346 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
+<head>
+<title>Cache update test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script class="testbody" type="text/javascript">
+
+/**
+ * This test loads manifest and checks presence of all items.
+ * Then it modifies the manifest and updates the cache again.
+ * Then test presence of items according to the spec and also
+ * if the cache associated with the document is still the old
+ * one. Then again modifies the manifest, checks items and finally
+ * swaps cache for this document, reloads and checks document state.
+ */
+
+const NAMESPACE_BYPASS = SpecialPowers.Ci.nsIApplicationCacheNamespace.NAMESPACE_BYPASS;
+const NAMESPACE_FALLBACK = SpecialPowers.Ci.nsIApplicationCacheNamespace.NAMESPACE_FALLBACK;
+
+var gStep = 0;
+var gGotFrameVersion = 0;
+var gCallOnUpdatingFrameLoad = null;
+
+// Helpers
+
+function reloadLocations(frames)
+{
+ for (frame in frames)
+ frames[frame].location.reload();
+}
+
+function waitForLocations(frames, doneFunc)
+{
+ frame = frames.shift();
+ if (frame)
+ // toString() might cause problems when this test will
+ // completely be changed to test IDN behavior.
+ OfflineTest.waitForAdd(frame, function()
+ {
+ waitForLocations(frames, doneFunc);
+ }
+ );
+ else
+ {
+ doneFunc();
+ }
+}
+
+function checkFallbackAndWhitelisting(key, fallback, onwhitelist)
+{
+ // Get matching namespace for the key
+ var matchingNamespace = OfflineTest.getActiveCache()
+ .getMatchingNamespace(key);
+
+ // If we are not expecting the key is to be on white list or
+ // has been assigned a fallback check there is not any matching
+ // namespace found and exit
+ if (!fallback && !onwhitelist) {
+ is(matchingNamespace, null, "No namespace found for "+key);
+ return;
+ }
+
+ // We expect this entry is on the white list or has a fallback
+ // entry assigned, check we found a matching namespace
+ ok(matchingNamespace, "We have a namespace for "+key);
+ if (!matchingNamespace)
+ return;
+
+ // We expect the key be assigned a fallback URI, check the namespace
+ // type is of fallback type
+ OfflineTest.is(!!(matchingNamespace.itemType & NAMESPACE_FALLBACK), !!fallback,
+ (fallback ? "Namespace type is fallback for " : "Namespace type is not fallback for ")+key);
+
+ // We expect the key be assigned a fallback URI, check the URI is
+ // equal to expected one
+ OfflineTest.is(matchingNamespace.data, fallback,
+ (fallback ? "Expected correct fallback for " : "No fallback for ")+key);
+
+ // We expect the key be on the white list, check the namespace type
+ // is of bypass type
+ OfflineTest.is(!!(matchingNamespace.itemType & NAMESPACE_BYPASS), onwhitelist,
+ (onwhitelist ? "On white list " : "Not on white list ")+key);
+}
+
+// Events
+
+function frameLoad(version)
+{
+ gGotFrameVersion = version;
+ if (gCallOnUpdatingFrameLoad)
+ {
+ var call = gCallOnUpdatingFrameLoad;
+ gCallOnUpdatingFrameLoad = null;
+ SimpleTest.executeSoon(OfflineTest.priv(call));
+ }
+}
+
+function whitelistOnLoad(version)
+{
+ // Whitelisting is not tested by this test...
+}
+
+
+// Start of the test function chain
+// ================================
+
+function manifestCached()
+{
+ OfflineTest.is(gStep, 0, "Got manifestCached in step 0, gStep=" + gStep);
+
+ reloadLocations([fallbackFrame1, fallbackFrame2]);
+ waitForLocations(
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html"],
+ fallbackLoaded
+ );
+}
+
+function fallbackLoaded()
+{
+ dump("in fallbackLoaded\n");
+ applicationCache.mozAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js");
+ OfflineTest.waitForAdd("http://mochi.test:8888/tests/SimpleTest/EventUtils.js",
+ dynamicLoaded);
+}
+
+function dynamicLoaded()
+{
+ window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html");
+ // window.applicationCache.noupdate invokes implicitLoaded()
+}
+
+function implicitLoaded(aWindow, errorOccured)
+{
+ aWindow.close();
+
+ OfflineTest.ok(!errorOccured, "No error on new implicit page manifest update");
+
+ OfflineTest.waitForAdd("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html",
+ implicitCached);
+}
+
+function implicitCached()
+{
+ // Checking first version of the manifest + another implict page caching
+
+ // Whitelist entries
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", true);
+
+ // Fallback URI selection check
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
+
+ // Cache object status
+ OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.IDLE,
+ "we have associated application cache (1)");
+
+ OfflineTest.is(gGotFrameVersion, 1, "IFrame version 1");
+
+ var entries = [
+ // Explicit entries
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
+
+ // Fallback entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false],
+
+ // Whitelist entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
+
+ // Implicit entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
+
+ // Dynamic entries
+ ["http://mochi.test:8888/tests/SimpleTest/EventUtils.js", true]
+ ];
+ OfflineTest.checkCacheEntries(
+ entries,
+ function() {
+ ++gStep;
+
+ OfflineTest.setSJSState("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs", "second");
+
+ applicationCache.update();
+ // Invokes manifestUpdated()
+ });
+}
+
+function manifestUpdated()
+{
+ OfflineTest.ok(gStep == 1 || gStep == 2, "Got manifestUpdated in step 1 or 2, gStep=" + gStep);
+
+ switch (gStep)
+ {
+ case 1:
+ // Processing second version of the manifest.
+
+ // Whitelist entries
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", false);
+
+ // Fallback URI selection check
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
+
+ // Cache object status
+ OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
+ "we have associated application cache and update is pending (2)");
+
+ var entries = [
+ // Explicit entries
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
+
+ // Fallback entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", true],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", true],
+
+ // Whitelist entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
+
+ // Implicit entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
+
+ // Dynamic entries
+ ["http://mochi.test:8888/tests/SimpleTest/EventUtils.js", true]
+ ];
+ OfflineTest.checkCacheEntries(
+ entries,
+ function() {
+ ++gStep;
+
+ OfflineTest.setSJSState("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs", "third");
+ OfflineTest.setSJSState("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs", "second");
+
+ gGotFrameVersion = 0;
+ updatingFrame.location.reload();
+ // Since the frame is offline-cached, reload of it invokes update
+ });
+
+ break;
+
+ case 2:
+ // Processing third version of the manifest.
+
+ // Whitelist entries
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", "", true);
+
+ // Fallback URI selection check
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
+ "", false);
+ checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
+
+ // Cache object status
+ OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
+ "we have associated application cache and update is pending (3)");
+
+ OfflineTest.is(gGotFrameVersion, 1, "IFrame version 1 because cache was not swapped");
+
+ var entries = [
+ // Explicit entries
+ ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
+
+ // Fallback entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false],
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", true],
+
+ // Whitelist entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html", false],
+
+ // Implicit entries
+ ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingImplicit.html", true],
+
+ // Dynamic entries
+ ["http://mochi.test:8888/tests/SimpleTest/EventUtils.js", true]
+ ];
+ OfflineTest.checkCacheEntries(
+ entries,
+ function() {
+ ++gStep;
+
+ applicationCache.onnoupdate = OfflineTest.priv(manifestNoUpdate);
+ applicationCache.update();
+ // Invokes manifestNoUpdate()
+ });
+
+ break;
+ }
+}
+
+function manifestNoUpdate()
+{
+ applicationCache.onnoupdate = null;
+
+ OfflineTest.ok(gStep == 3, "Got manifestNoUpdate in step 3, gStep=" + gStep);
+ ++gStep;
+
+ OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
+ "we have associated application cache and update is pending (4)");
+ applicationCache.swapCache();
+ OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.IDLE,
+ "we have associated application cache (4)");
+
+ gGotFrameVersion = 0;
+ gCallOnUpdatingFrameLoad = checkNewVersionOfIFrame;
+ updatingFrame.location.reload();
+}
+
+function checkNewVersionOfIFrame()
+{
+ OfflineTest.is(gGotFrameVersion, 2, "IFrame version 2");
+
+ OfflineTest.teardownAndFinish();
+}
+
+// End of the test function chain
+// ==============================
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.onupdateready = OfflineTest.priv(manifestUpdated);
+ applicationCache.oncached = OfflineTest.priv(manifestCached);
+}
+
+</script>
+
+</head>
+
+<body>
+ <iframe name="updatingFrame" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs"></iframe>
+ <iframe name="fallbackFrame1" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html"></iframe>
+ <iframe name="fallbackFrame2" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html"></iframe>
+ <iframe name="whitelistFrame" src="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/onwhitelist.html"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml b/dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml
new file mode 100644
index 000000000..b3c2c30e5
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml
@@ -0,0 +1,32 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>xhtml manifest test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function manifestUpdated()
+{
+ OfflineTest.ok(true, "Application cache updated.");
+
+ OfflineTest.teardownAndFinish();
+}
+
+if (OfflineTest.setup()) {
+ applicationCache.onerror = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest
new file mode 100644
index 000000000..ea6da2445
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest
@@ -0,0 +1,10 @@
+CACHE MANIFEST
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+
+UNKNOWN-SECTION:
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg
+here can be anything the current implementaion
+is not able to parse at all and is just silently ignored
+
+CACHE:
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
diff --git a/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
diff --git a/dom/tests/mochitest/ajax/offline/updatingIframe.sjs b/dom/tests/mochitest/ajax/offline/updatingIframe.sjs
new file mode 100644
index 000000000..91325d282
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/updatingIframe.sjs
@@ -0,0 +1,45 @@
+ver1iframe =
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
+ "<head>\n" +
+ "<title>Update iframe</title>\n" +
+ "</head>\n" +
+ "<body onload=\"parent.frameLoad(1)\">\n" +
+ "First version of updating iframe.\n" +
+ "</body>\n" +
+ "</html>\n";
+
+ver2iframe =
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
+ "<head>\n" +
+ "<title>Update iframe</title>\n" +
+ "</head>\n" +
+ "<body onload=\"parent.frameLoad(2)\">\n" +
+ "Second version of updating iframe.\n" +
+ "</body>\n" +
+ "</html>\n";
+
+function handleRequest(request, response)
+{
+ var match = request.queryString.match(/^state=(.*)$/);
+ if (match)
+ {
+ response.setStatusLine(request.httpVersion, 204, "No content");
+ setState("offline.updatingIframe", match[1]);
+ }
+
+ if (request.queryString == "")
+ {
+ response.setStatusLine(request.httpVersion, 200, "Ok");
+ response.setHeader("Content-Type", "text/html");
+ response.setHeader("Cache-Control", "no-cache");
+ switch (getState("offline.updatingIframe"))
+ {
+ case "": // The default value
+ response.write(ver1iframe);
+ break;
+ case "second":
+ response.write(ver2iframe);
+ break;
+ }
+ }
+}
diff --git a/dom/tests/mochitest/ajax/offline/updatingImplicit.html b/dom/tests/mochitest/ajax/offline/updatingImplicit.html
new file mode 100644
index 000000000..6e95b4084
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/updatingImplicit.html
@@ -0,0 +1,53 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs">
+<head>
+<title>Updating implicit</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+<script type="text/javascript">
+
+function manifestUpdated()
+{
+ // Assert that we are properly associated with the application
+ // cache.
+ var req = new XMLHttpRequest;
+ req.open("GET", "namespace2/script3.js", false);
+ try {
+ req.send(null);
+ window.opener.OfflineTest.ok(false, "Able to fetch unlisted resource, not properly associated.");
+ } catch(ex) {
+ window.opener.OfflineTest.ok(true, "Unable to fetch unlisted resource, properly associated.");
+ }
+
+ req = new XMLHttpRequest;
+ req.open("GET", "updatingImplicit.html", false);
+ try {
+ req.send(null);
+ window.opener.OfflineTest.ok(true, "Able to fetch listed resource, properly associated.");
+ } catch(ex) {
+ window.opener.OfflineTest.ok(false, "Unable to fetch listed resource, not properly associated.");
+ }
+
+ window.opener.implicitLoaded(window, false);
+}
+
+function manifestError()
+{
+ window.opener.implicitLoaded(window, true);
+}
+
+if (OfflineTest.setupChild()) {
+ applicationCache.onerror = OfflineTest.priv(manifestError);
+ applicationCache.onupdateready = OfflineTest.failEvent;
+ applicationCache.oncached = OfflineTest.failEvent;
+ applicationCache.onnoupdate = OfflineTest.priv(manifestUpdated);
+}
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/ajax/offline/updatingManifest.sjs b/dom/tests/mochitest/ajax/offline/updatingManifest.sjs
new file mode 100644
index 000000000..3d95bdcd6
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/updatingManifest.sjs
@@ -0,0 +1,66 @@
+ver1manifest =
+ "CACHE MANIFEST\n" +
+ "# v1\n" +
+ "\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs\n" +
+ "\n" +
+ "FALLBACK:\n" +
+ "namespace1/ fallback.html\n" +
+ "\n" +
+ "NETWORK:\n" +
+ "onwhitelist.html\n";
+
+ver2manifest =
+ "CACHE MANIFEST\n" +
+ "# v2\n" +
+ "\n" +
+ "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" +
+ "\n" +
+ "FALLBACK:\n" +
+ "namespace1/ fallback.html\n" +
+ "namespace1/sub/ fallback2.html\n";
+
+ver3manifest =
+ "CACHE MANIFEST\n" +
+ "# v3\n" +
+ "\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" +
+ "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingIframe.sjs" +
+ "\n" +
+ "FALLBACK:\n" +
+ "namespace1/sub fallback2.html\n" +
+ "\n" +
+ "NETWORK:\n" +
+ "onwhitelist.html\n";
+
+function handleRequest(request, response)
+{
+ var match = request.queryString.match(/^state=(.*)$/);
+ if (match)
+ {
+ response.setStatusLine(request.httpVersion, 204, "No content");
+ setState("offline.updatingManifest", match[1]);
+ }
+
+ if (request.queryString == "")
+ {
+ response.setStatusLine(request.httpVersion, 200, "Ok");
+ response.setHeader("Content-Type", "text/cache-manifest");
+ response.setHeader("Cache-Control", "no-cache");
+ switch (getState("offline.updatingManifest"))
+ {
+ case "": // The default value
+ response.write(ver1manifest + "\n#" + getState("offline.updatingManifest"));
+ break;
+ case "second":
+ response.write(ver2manifest + "\n#" + getState("offline.updatingManifest"));
+ break;
+ case "third":
+ response.write(ver3manifest + "\n#" + getState("offline.updatingManifest"));
+ break;
+ }
+ }
+}
diff --git a/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest
new file mode 100644
index 000000000..558f703bc
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest
@@ -0,0 +1,7 @@
+CACHE MANIFEST
+
+http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
+http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
+
+NETWORK:
+*
diff --git a/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^ b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^
new file mode 100644
index 000000000..5efde3c5b
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest^headers^
@@ -0,0 +1,2 @@
+Content-Type: text/cache-manifest
+
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 000000000..69f82032a
--- /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 000000000..0f4b94938
--- /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 000000000..1beb8a707
--- /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 000000000..6af573fad
--- /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 000000000..ec699f9d4
--- /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 000000000..2b586ee42
--- /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 000000000..526e711f9
--- /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 000000000..63375477a
--- /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 000000000..6fe8f51c9
--- /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 000000000..9ceb98518
--- /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 000000000..c3f9d4114
--- /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 000000000..f2843128a
--- /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 000000000..ebb3b383e
--- /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 000000000..239179375
--- /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 000000000..fdc7c019d
--- /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 000000000..ae10a77a7
--- /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 000000000..4af5e267a
--- /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 000000000..8487943f7
--- /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 000000000..8f091878c
--- /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 000000000..5a08fbd55
--- /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 000000000..8e9e00bd5
--- /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 000000000..ee3701d3c
--- /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 000000000..85391eb93
--- /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 000000000..453a569c2
--- /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 000000000..1273098e6
--- /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 000000000..18f62f354
--- /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 000000000..583d0e5f3
--- /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 000000000..22b1c3fd1
--- /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 000000000..e69de29bb
--- /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 000000000..8b1378917
--- /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 000000000..5e7e8f3b3
--- /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 000000000..5fae7662d
--- /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 000000000..baa88a7d1
--- /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 000000000..dc7f171bf
--- /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 000000000..be5ccfa7d
--- /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 000000000..63d81117b
--- /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 000000000..71574abd7
--- /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 000000000..5fd7bdf4b
--- /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 000000000..d745c8fd5
--- /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 000000000..e4483a5b6
--- /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 000000000..15d303aa3
--- /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 000000000..4cda87d81
--- /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 000000000..cc3d08313
--- /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 000000000..4e09529b2
--- /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 000000000..5cea791b1
--- /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 000000000..bcf5acb0b
--- /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 000000000..72506fc17
--- /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 000000000..c4e21f095
--- /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 000000000..b38fd306c
--- /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 000000000..cc3b9ef62
--- /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 000000000..bcd29f91d
--- /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 000000000..c1ffb7536
--- /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 000000000..51a789e79
--- /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 000000000..8f462b639
--- /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 000000000..12accf239
--- /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 000000000..14349eb51
--- /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 000000000..4e4f0be75
--- /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 000000000..85eed3191
--- /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 000000000..78ed551d0
--- /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 000000000..cbc6f828b
--- /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 000000000..84bde55e5
--- /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 000000000..74564fc0c
--- /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 000000000..b684225ba
--- /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 000000000..e7afdd60b
--- /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 000000000..a65094995
--- /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 000000000..1beb8a89a
--- /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 000000000..b0f6322df
--- /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 000000000..d4250c640
--- /dev/null
+++ b/dom/tests/mochitest/ajax/scriptaculous/mochitest.ini
@@ -0,0 +1,34 @@
+[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]
+skip-if = toolkit == 'android'
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 000000000..0cf631b19
--- /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 000000000..7d4f16ece
--- /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 000000000..10c7c9326
--- /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 000000000..eb69587e6
--- /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 000000000..13f91cd6f
--- /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 000000000..b9c96bfbd
--- /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 000000000..46618d901
--- /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 000000000..1e2e743a4
--- /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 000000000..55dcbeae1
--- /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 000000000..a6f35d132
--- /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 000000000..5f11f56ce
--- /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 000000000..f03b34ffc
--- /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 000000000..742ff18f1
--- /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 000000000..69c1fadc7
--- /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 000000000..c68f09422
--- /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("transparent", Element.getStyle('tobeedited','background-color'));
+ inPlaceEditor.dispose();
+ assertEqual("transparent", 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("transparent", 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 000000000..02cb10bff
--- /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 000000000..347519838
--- /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 000000000..686bd0f6f
--- /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 000000000..4fb629658
--- /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 000000000..88fcb3f41
--- /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 000000000..f752986b7
--- /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 000000000..d36f96ccc
--- /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 000000000..0644c631b
--- /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 000000000..018b45d07
--- /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 000000000..c2bafd0b9
--- /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 000000000..995dba496
--- /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 000000000..39c078959
--- /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 000000000..f0bf2cbe6
--- /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 000000000..9dc4e4aab
--- /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 type="text/javascript" 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); }, false);
+
+</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 000000000..a3b6f2593
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-handler.sjs
@@ -0,0 +1,127 @@
+/* -*- 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: data, QueryInterface: function(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": data,
+ "mimetype": 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 "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 = 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 000000000..f6d70fa8a
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-originheader-handler.sjs
@@ -0,0 +1,48 @@
+/*
+ * 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 000000000..6a760cb84
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-preflight-handler.sjs
@@ -0,0 +1,39 @@
+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 000000000..bb7e50dba
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-redirect-handler.sjs
@@ -0,0 +1,47 @@
+/*
+ * 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 000000000..341620eae
--- /dev/null
+++ b/dom/tests/mochitest/beacon/beacon-set-cookie.sjs
@@ -0,0 +1,8 @@
+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 000000000..ff5afd546
--- /dev/null
+++ b/dom/tests/mochitest/beacon/chrome.ini
@@ -0,0 +1,6 @@
+[DEFAULT]
+skip-if = os == 'android'
+
+[test_beaconCookies.html]
+support-files = beacon-set-cookie.sjs
+ file_beaconCookies.html
diff --git a/dom/tests/mochitest/beacon/file_beaconCookies.html b/dom/tests/mochitest/beacon/file_beaconCookies.html
new file mode 100644
index 000000000..aeecb2263
--- /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/mochitest.ini b/dom/tests/mochitest/beacon/mochitest.ini
new file mode 100644
index 000000000..0093ceed7
--- /dev/null
+++ b/dom/tests/mochitest/beacon/mochitest.ini
@@ -0,0 +1,13 @@
+[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]
+[test_beaconPreflightWithCustomContentType.html]
+[test_beaconContentPolicy.html]
+[test_beaconOriginHeader.html]
+[test_beaconRedirect.html]
diff --git a/dom/tests/mochitest/beacon/test_beacon.html b/dom/tests/mochitest/beacon/test_beacon.html
new file mode 100644
index 000000000..697431bca
--- /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 type="text/javascript" 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 000000000..87e44ae64
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconContentPolicy.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=936340
+-->
+<head>
+ <title>Test that sendBeacon obeys content policy directives</title>
+ <script type="text/javascript" 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: function(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: function(outer, iid) {
+ return this.QueryInterface(iid);
+ },
+
+ // nsIContentPolicy implementation
+ shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) {
+ // Remember last content type seen for the test url
+
+ 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: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) {
+ 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 000000000..e2c4f3b7d
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconCookies.html
@@ -0,0 +1,89 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=936340
+-->
+<head>
+ <title>Test whether sendBeacon sets cookies</title>
+ <script type="text/javascript" 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);
+
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+Cu.import("resource://gre/modules/Services.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", false);
+}
+
+function testOnWindow(options, callback) {
+ var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
+
+ 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", false);
+ aNormalWindow.gBrowser.selectedBrowser.loadURI(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", false);
+ aPrivateWindow.gBrowser.selectedBrowser.loadURI(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 000000000..1bcdcca05
--- /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 type="text/javascript" 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", "application/octet-stream", 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 000000000..4594b7a8b
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconOriginHeader.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1280692 - navigator.sendBeacon() should not send origin header</title>
+ <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
+ <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>
+ <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";
+// no origin header should be sent with sendBeacon request;
+// server returns any origin-header or 'no-header' if there is no header sent.
+const ORIGIN_HEADER = "no-header";
+
+/* Description of the test:
+ * We call sendBeacon() cross origin and make sure that the
+ * origin header is actually *not* 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 not 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 000000000..e8e2add11
--- /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 type="text/javascript" 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 000000000..614e3b5b3
--- /dev/null
+++ b/dom/tests/mochitest/beacon/test_beaconRedirect.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1280692 - sendBeacon() should follow 30x redirect</title>
+ <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
+ <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>
+ <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 a few seconds before we can query the result.
+ interval = 4000;
+ if (navigator.appVersion.indexOf("Android") >= 0) {
+ // Android Debug on an emulator can be very slow
+ interval = 10000;
+ }
+ intervalID = setInterval(queryIfRedirectSucceeded, interval);
+}
+
+</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 000000000..aae8247ae
--- /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 000000000..bc6f6a903
--- /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 000000000..277d35874
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-opener-echoer.html
@@ -0,0 +1,6 @@
+<script>
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ window.opener.opener.postMessage(window.opener.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 000000000..52facb07a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-opener.html
@@ -0,0 +1,15 @@
+<body onload="postBack();">
+ <script>
+ function postBack() {
+ var s = decodeURIComponent(window.location.search.substring(1));
+ var cmd = JSON.parse(s);
+ if ("load" in cmd) {
+ window.testNum = cmd.load;
+ } else if ("write" in cmd) {
+ window.testNum = cmd.write;
+ }
+ 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 000000000..e5035397f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-parent-echoer.html
@@ -0,0 +1,5 @@
+<script>
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ window.parent.opener.postMessage(window.parent.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 000000000..0fea91c69
--- /dev/null
+++ b/dom/tests/mochitest/bugs/bug346659-parent.html
@@ -0,0 +1,17 @@
+<body onload="postBack();">
+ <script>
+ var childWin;
+ function postBack() {
+ childWin = window.frames[0];
+ var s = decodeURIComponent(window.location.search.substring(1));
+ var cmd = JSON.parse(s);
+ if ("load" in cmd) {
+ window.testNum = cmd.load;
+ } else if ("write" in cmd) {
+ window.testNum = cmd.write;
+ }
+ 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 000000000..90f848e4f
--- /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 000000000..e8f7d578b
--- /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 000000000..c3ceb858b
--- /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 000000000..43bcb6028
--- /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/file_bug291653.html b/dom/tests/mochitest/bugs/file_bug291653.html
new file mode 100644
index 000000000..4bfc8337e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug291653.html
@@ -0,0 +1,28 @@
+<html>
+ <head>
+ <script>
+ <!--
+ function listener1() {
+ window.showModalDialog("data:text/html,<script>var maintest = opener.opener; opener.location = 'data:text/html,test'; maintest.end(); window.close();</script>");
+ }
+
+ function listener2() {
+ opener.secondListenerDidRun = true;
+ }
+
+ window.addEventListener("foo", listener1);
+ window.addEventListener("foo", listener2);
+
+
+ function fireFoo() {
+ var e = document.createEvent("Events");
+ e.initEvent("foo", true, true);
+ window.dispatchEvent(e);
+ }
+ //-->
+ </script>
+ </head>
+ <body onload="setTimeout(fireFoo, 0)">
+ Test for bug 291653
+ </body>
+</html>
diff --git a/dom/tests/mochitest/bugs/file_bug406375.html b/dom/tests/mochitest/bugs/file_bug406375.html
new file mode 100644
index 000000000..215257824
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug406375.html
@@ -0,0 +1,5 @@
+<script>
+ var w = window.open("about:blank", "", "width=200,height=200,dialog");
+ w.close();
+ window.close();
+</script>
diff --git a/dom/tests/mochitest/bugs/file_bug504862.html b/dom/tests/mochitest/bugs/file_bug504862.html
new file mode 100644
index 000000000..dc11ced6f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug504862.html
@@ -0,0 +1,22 @@
+<html>
+<body>
+<script>
+window.returnValue = 3;
+
+if (location.toString().match(/^http:\/\/mochi.test:8888/)) {
+ // Test that we got the right arguments.
+ opener.is(window.dialogArguments, "my args",
+ "dialog did not get the right arguments.");
+
+ // Load a different url, and test that it sees the arguments (since it's same origin).
+ window.location="data:text/html,<html><body onload=\"opener.is(window.dialogArguments, 'my args', 'subsequent dialog document did not get the right arguments.'); close();\">';";
+} else {
+ // Post a message containing our arguments to the opener to test
+ // that this cross origing dialog does *not* see the passed in
+ // arguments.
+ opener.postMessage("args: " + window.dialogArguments,
+ "http://mochi.test:8888");
+
+ close();
+}
+</script>
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 000000000..ec455fcf2
--- /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 000000000..8379b11d5
--- /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()' src='data:text/html,
+ <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 000000000..3a3863a61
--- /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 000000000..83c6f894c
--- /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 000000000..2d8c135e9
--- /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_bug927901.html b/dom/tests/mochitest/bugs/file_bug927901.html
new file mode 100644
index 000000000..907b0d96c
--- /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 000000000..edc004ad1
--- /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 000000000..ca105f950
--- /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 000000000..ee9240e3a
--- /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 000000000..70478e69a
--- /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_window_bar.html b/dom/tests/mochitest/bugs/file_window_bar.html
new file mode 100644
index 000000000..59b2c1601
--- /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 000000000..a786c5b9e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/grandchild_bug260264.html
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <script type="application/javascript" 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 000000000..2721c5c78
--- /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 000000000..3a922b9b2
--- /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_bug38959-1.html b/dom/tests/mochitest/bugs/iframe_bug38959-1.html
new file mode 100644
index 000000000..d4c16c47a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug38959-1.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+ <title>Iframe test for bug 38959</title>
+</head>
+<body">
+<script>
+
+x = false;
+window.opener.postMessage(1, "http://mochi.test:8888");
+window.close();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/iframe_bug38959-2.html b/dom/tests/mochitest/bugs/iframe_bug38959-2.html
new file mode 100644
index 000000000..36cd0c156
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug38959-2.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+ <title>Iframe test for bug 38959</title>
+</head>
+<body">
+<script>
+
+x = true;
+window.opener.postMessage(2, "http://mochi.test:8888");
+window.close();
+
+</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 000000000..0d495cc97
--- /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 000000000..703eb5dd5
--- /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 000000000..c8d9f8fe2
--- /dev/null
+++ b/dom/tests/mochitest/bugs/iframe_bug440572.html
@@ -0,0 +1,17 @@
+<html>
+<body>
+<script>
+
+var success = 0;
+
+try {
+ parent[name].success = 1;
+ parent.postMessage(success ? "success" : "failure", "http://mochi.test:8888");
+} catch (e) {
+ parent.postMessage(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 000000000..e1df2f6de
--- /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 000000000..f37339377
--- /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 000000000..e0c71f857
--- /dev/null
+++ b/dom/tests/mochitest/bugs/mochitest.ini
@@ -0,0 +1,164 @@
+[DEFAULT]
+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_bug291653.html
+ file_bug406375.html
+ file_bug504862.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_bug38959-1.html
+ iframe_bug38959-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
+
+[test_DOMWindowCreated_chromeonly.html]
+[test_bug132255.html]
+[test_bug159849.html]
+[test_bug289714.html]
+[test_bug260264.html]
+skip-if = toolkit == 'android'
+[test_bug260264_nested.html]
+[test_bug265203.html]
+[test_bug291377.html]
+[test_bug291653.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_bug304459.html]
+[test_bug308856.html]
+[test_bug327891.html]
+[test_bug333983.html]
+[test_bug335976.xhtml]
+[test_bug342448.html]
+[test_bug345521.html]
+[test_bug346659.html]
+[test_bug351601.html]
+[test_bug369306.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_bug370098.html]
+[test_bug377539.html]
+[test_bug384122.html]
+[test_bug389366.html]
+[test_bug38959.html]
+[test_bug393974.html]
+[test_bug394769.html]
+[test_bug396843.html]
+[test_bug400204.html]
+[test_bug404748.html]
+[test_bug406375.html]
+skip-if = toolkit == 'android'
+[test_bug414291.html]
+tags = openwindow
+[test_bug427744.html]
+skip-if = toolkit == 'android'
+[test_bug42976.html]
+[test_bug430276.html]
+[test_bug437361.html]
+skip-if = toolkit == 'android'
+[test_bug440572.html]
+[test_bug456151.html]
+[test_bug458091.html]
+[test_bug459848.html]
+[test_bug465263.html]
+[test_bug479143.html]
+skip-if = toolkit == 'android'
+[test_bug484775.html]
+[test_bug492925.html]
+[test_bug49312.html]
+[test_bug495219.html]
+[test_bug504862.html]
+skip-if = toolkit == 'android' #RANDOM
+[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_bug597809.html]
+skip-if = toolkit == 'android'
+[test_bug61098.html]
+skip-if = toolkit == 'android'
+[test_bug612267.html]
+[test_bug617296.html]
+[test_bug620947.html]
+[test_bug622361.html]
+[test_bug633133.html]
+[test_bug641552.html]
+skip-if = toolkit == 'android'
+[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_bug735237.html]
+[test_bug739038.html]
+[test_bug740811.html]
+[test_bug743615.html]
+[test_bug750051.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_bug876098.html]
+[test_bug927901.html]
+[test_devicemotion_multiple_listeners.html]
+skip-if = toolkit == 'android' #bug 775227
+[test_domparser_after_blank.html]
+[test_errorReporting.html]
+[test_onerror_message.html]
+[test_protochains.html]
+[test_resize_move_windows.html]
+skip-if = toolkit == 'android' || os == 'linux' #Windows can't change size and position on Android
+[test_sizetocontent_clamp.html]
+skip-if = toolkit == 'android' #Windows can't change size on Android
+[test_toJSON.html]
+[test_window_bar.html]
+skip-if = toolkit == 'android'
+[test_bug1022869.html]
+[test_bug1112040.html]
+[test_bug1160342_marquee.html]
+[test_bug1171215.html]
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 000000000..fc1a4cbbc
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_DOMWindowCreated_chromeonly.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<head>
+ <title>DOMWindowCreated not visible in content</title>
+ <script type="application/javascript" 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"); }, false);
+ window.addEventListener("DOMDocElementInserted", function() { ok(false, "DOMDocElementInserted should not have fired"); }, false);
+
+ <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 000000000..d094f5a6c
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <iframe src="data:text/html,<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 000000000..690d24e66
--- /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 type="application/javascript" 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 000000000..8da13478e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1160342_marquee.html
@@ -0,0 +1,337 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1160342
+-->
+<head>
+ <title>Test for Bug 411103</title>
+ <script type="text/javascript" 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");
+ try {
+ x.behavior = 'invalid';
+ todo_is(false, true, "marquee.behavior = 'invalid' should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.behavior, "alternate", "Wrong behavior value");
+ is(x.getAttribute('behavior'), "alternate", "Wrong behavior attribute");
+ x.behavior = 'Slide';
+ is(x.behavior, "slide", "Wrong behavior value");
+ is(x.getAttribute('behavior'), "slide", "Wrong behavior attribute");
+ try {
+ x.behavior = 'invalid';
+ todo_is(false, true, "marquee.behavior = 'invalid' should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ try {
+ x.behavior = null;
+ x.behavior = undefined;
+ todo_is(false, true, "marquee.behavior = 'invalid' should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.behavior, "slide", "Wrong behavior value");
+ is(x.getAttribute('behavior'), "slide", "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, 1000, "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 = null 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 = null 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, 1000, "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 scrolldelay attribute");
+ try {
+ x.scrollAmount = -2;
+ todo_is(false, true, "marquee.scrollAmount = -2 should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.scrollAmount, 1, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "1", "Wrong scrolldelay attribute");
+ x.scrollAmount = 'invalid';
+ is(x.scrollAmount, 0, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "0", "Wrong scrolldelay attribute");
+ x.scrollAmount = 1;
+ x.scrollAmount = null;
+ is(x.scrollAmount, 0, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "0", "Wrong scrolldelay attribute");
+ x.scrollAmount = '2';
+ is(x.scrollAmount, 2, "Wrong scrollAmount value");
+ is(x.getAttribute('scrollamount'), "2", "Wrong scrolldelay 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, 1000, "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");
+ try {
+ x.scrollDelay = -2;
+ todo_is(false, true, "marquee.scrollDelay = -2 should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.scrollDelay, 100, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute");
+ try {
+ x.scrollDelay = 'invalid';
+ todo_is(false, true, "marquee.scrollDelay = 'invalid' should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.scrollDelay, 100, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute");
+ try {
+ x.scrollDelay = null;
+ todo_is(false, true, "marquee.scrollDelay = null should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.scrollDelay, 100, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute");
+ try {
+ x.scrollDelay = -1;
+ todo_is(false, true, "marquee.scrollDelay = -1 should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.scrollDelay, 100, "Wrong scrollDelay value");
+ is(x.getAttribute('scrolldelay'), "100", "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");
+ try {
+ x.direction = 1;
+ todo_is(false, true, "marquee.direction = 1 should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.direction, "down", "Wrong direction value");
+ is(x.getAttribute('direction'), "down", "Wrong direction attribute");
+ try {
+ x.direction = null;
+ todo_is(false, true, "marquee.direction = null should throw");
+ } catch(e) {
+ ok(true, "Exception was raised");
+ }
+ is(x.direction, "down", "Wrong direction value");
+ is(x.getAttribute('direction'), "down", "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 000000000..d989fb62e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug1171215.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1022869
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1022869</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <iframe src="about:blank"></iframe>
+ <script type="text/javascript; version=1.8">
+
+ var f = document.getElementsByTagName("iframe")[0];
+
+ SimpleTest.waitForExplicitFinish();
+
+ /** Test for Bug 1022869 **/
+ function startTest() {
+ // Initialize our cookie.
+ document.cookie = "a=b";
+
+ // 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(function() {
+ // Cookies are set up, disallow third-party cookies and start the test.
+ SpecialPowers.pushPrefEnv({ set: [[ 'network.cookie.cookieBehavior', 1 ]] },
+ () => { spawn_task(continueTest); });
+ }).catch((e) => { ok(false, `Got exception: ${e}`) });
+ }
+
+ function waitForLoad() {
+ return new Promise((resolve) => {
+ window.addEventListener("message", function received(msg) {
+ window.removeEventListener("message", received);
+ info(`got message ${msg.data}`);
+ resolve(msg.data);
+ });
+ });
+ }
+
+ 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 = yield waitForLoad();
+ is(cookie, "a=b", "got the cookie");
+
+ // Cross origin to cross origin.
+ f.contentWindow.location = createRedirect(thirdParty, thirdParty);
+ cookie = yield waitForLoad();
+ is(cookie, "", "no third-party cookies");
+
+ // Same origin to cross origin.
+ f.contentWindow.location = createRedirect(sameOrigin, thirdParty);
+ cookie = yield waitForLoad();
+ is(cookie, "", "no third-party cookies");
+
+ // Cross origin to same origin
+ f.contentWindow.location = createRedirect(thirdParty, sameOrigin);
+ cookie = yield waitForLoad();
+ is(cookie, "a=b", "got the cookie");
+
+ 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_bug132255.html b/dom/tests/mochitest/bugs/test_bug132255.html
new file mode 100644
index 000000000..a2165d886
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug132255.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=132255
+-->
+<head>
+ <title>Test for Bug 132255</title>
+ <script type="application/javascript" 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(/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_bug159849.html b/dom/tests/mochitest/bugs/test_bug159849.html
new file mode 100644
index 000000000..ed5ddf19a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug159849.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=159849
+-->
+<head>
+ <title>Test for Bug 159849</title>
+ <script type="text/javascript" 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");
+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_bug260264.html b/dom/tests/mochitest/bugs/test_bug260264.html
new file mode 100644
index 000000000..420281858
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" 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.waitForExplicitFinish();
+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") };
+
+
+function run_tests() {
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ window.open.close().then(() => {
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests2);
+ });
+}
+
+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);
+ window.open.close(1).then(() => {
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkBlocked);
+ send(a, "mouseup", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0)
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests3);
+ });
+}
+
+function run_tests3() {
+ send(a, "mouseover", checkBlocked);
+ window.open.close().then(() => {
+ SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests4);
+ });
+ });
+}
+
+function run_tests4() {
+ var count;
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ window.open.close().then(() => {
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkOpened);
+ return window.open.close();
+ }).then(() => {
+ for (count = 0, n = 0; n < 3; n++)
+ send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
+ send(a, "mouseover", checkBlocked);
+ return window.open.close(1);
+ }).then(() => {
+ send(a, "mouseover", checkOpened);
+ send(a, "mouseover", checkBlocked);
+ send(a, "mouseover", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0)
+ send(a, "mouseover", checkOpened);
+ send(a, "mouseover", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events", "click"]]}, run_tests5);
+ });
+}
+
+function run_tests5() {
+ SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION, 'context': document}], run_tests6);
+}
+
+function run_tests6() {
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ window.open.close().then(() => {
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests7);
+ });
+}
+
+function run_tests7() {
+ send(a, "mouseup", checkBlocked);
+ window.open.close().then(() => {
+ send(a, "mouseover", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests8);
+ });
+ });
+}
+
+function run_tests8() {
+ var count;
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ send(a, "click", checkOpened);
+ window.open.close().then(() => {
+ for (count = 0, n = 0; n < 3; n++)
+ send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
+ send(a, "mouseup", checkBlocked);
+ return window.open.close(1);
+ }).then(() => {
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkBlocked);
+ send(a, "mouseup", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0)
+ send(a, "mouseup", checkOpened);
+ send(a, "mouseup", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ for (count = 0, n = 0; n < 3; n++)
+ send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
+ send(a, "mouseover", checkBlocked);
+ return window.open.close(1);
+ }).then(() => {
+ send(a, "mouseover", checkOpened);
+ send(a, "mouseover", checkBlocked);
+ send(a, "mouseover", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ ok(count > 0, "Windows left open by previous tests?");
+ while (count --> 0)
+ send(a, "mouseover", checkOpened);
+ send(a, "mouseover", checkBlocked);
+ return window.open.close();
+ }).then(() => {
+ SimpleTest.finish();
+ });
+}
+
+function check_sanity() {
+ ok(SpecialPowers.testPermission('popup', UNKNOWN_ACTION, document), 'popup value should have UNKNOWN permission');
+ SpecialPowers.pushPermissions([{'type': 'popup', 'allow': true, 'context': document}], check_sanity2);
+}
+
+function check_sanity2() {
+ ok(SpecialPowers.testPermission('popup', ALLOW_ACTION, document), 'popup value should have ALLOW permission');
+ SpecialPowers.pushPrefEnv({"set": [["dom.disable_open_during_load", true],
+ ["dom.popup_allowed_events", "click mouseup"],
+ ["dom.popup_maximum", 3]]}, function() {
+ // Note: UNKNOWN_ACTION is the same as DENY_ACTION.
+ SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION, 'context': document}], run_tests);
+ });
+}
+
+setTimeout(function() {
+ SpecialPowers.pushPermissions([{'type': 'popup', 'remove': true, 'context': document}], check_sanity);
+}, 200);
+
+</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 000000000..230324389
--- /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 type="application/javascript" 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: function(aNext) {
+ setupPP("click mouseup", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "mouseup",
+ setup: function(aNext) {
+ setupPP("click mouseup", ALLOW_ACTION, ALLOW_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "mouseup",
+ setup: function(aNext) {
+ setupPP("click", ALLOW_ACTION, ALLOW_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "mouseup",
+ setup: function(aNext) {
+ setupPP("click", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_have_blocked
+ },
+ { event: "mouseover",
+ setup: function(aNext) {
+ setupPP("click mouseup", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_have_blocked
+ },
+ { event: "mouseover",
+ setup: function(aNext) {
+ setupPP("click mouseup", ALLOW_ACTION, ALLOW_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "click",
+ setup: function(aNext) {
+ setupPP("click mouseup", DENY_ACTION, DENY_ACTION, aNext);
+ },
+ report: should_not_have_blocked
+ },
+ { event: "click",
+ setup: function(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 000000000..e5fe713f5
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug265203.html
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=265203
+-->
+<head>
+ <title>Test for Bug 265203</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=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("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ expectedResult = [ $("a1").firstChild, 7, $("a2") ]
+ nextTest = test2;
+ testFocus();
+}
+function test2() {
+ $("a3").focus();
+ expectedResult = [ $("a3"), 0, $("a3") ]
+ nextTest = test3;
+ testFocus();
+}
+function test3() {
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ expectedResult = [ $("a3").firstChild, 7, $("a3") ]
+ nextTest = SimpleTest.finish;
+ testFocus();
+}
+
+function startTest() {
+ if (gTestStarted)
+ return;
+ gTestStarted = true;
+ // Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown
+ // events
+ SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true], ["snav.enabled", false]]}, 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 000000000..e52e375e4
--- /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 type="text/javascript" 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 000000000..1d3de1dfc
--- /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 type="text/javascript" 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_bug291653.html b/dom/tests/mochitest/bugs/test_bug291653.html
new file mode 100644
index 000000000..1543cdd96
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug291653.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=291653
+-->
+<head>
+ <title>Test for Bug 291653</title>
+ <script type="application/javascript" 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=291653">Mozilla Bug 291653</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 291653 **/
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+var secondListenerDidRun = false;
+
+var w;
+function start() {
+ if ("showModalDialog" in window) {
+ w = window.open("file_bug291653.html", "foo", "width=300,height=300");
+ } else {
+ // window.showModalDialog doesn't exist in e10s mode, nothing to do in this test.
+ ok(true, "nothing to do in e10s mode");
+ SimpleTest.finish();
+ }
+}
+
+function closeTest() {
+ w.setTimeout("close()", 0);
+ setTimeout("finish()", 500);
+}
+
+function finish() {
+ ok(!secondListenerDidRun, "Shouldn't have run second listener!");
+ SimpleTest.finish();
+}
+
+function end() {
+ setTimeout("closeTest()", 500);
+}
+
+start();
+
+</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 000000000..baf25d570
--- /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 type="application/javascript" 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, false);
+
+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 000000000..4d32535c2
--- /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 type="text/javascript" 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 000000000..61a0771a3
--- /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 type="text/javascript" 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 000000000..d5ea7abee
--- /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 type="text/javascript" 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 000000000..39137eb64
--- /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 type="text/javascript" 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 src="data:application/xhtml+xml,&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;body&gt; &lt;textbox xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'/&gt; &lt;/body&gt;&lt;/html&gt;" style="width: 95%; height: 150px;"></iframe>
+
+<div id="rootish" style="background: yellow">
+ <div>
+ <textbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
+ </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("textbox");
+ 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 000000000..f5cd05151
--- /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 type="text/javascript" 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 000000000..ce98016bf
--- /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 type="text/javascript" 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 000000000..78c1fc659
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug346659.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=346659
+-->
+<head>
+ <title>Test for Bug 346659</title>
+ <script type="application/javascript" 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);
+}
+
+function handleCmd(evt) {
+ var cmd;
+ try {
+ cmd = JSON.parse(evt.data);
+ } catch (e) {
+ // Not json
+ return false;
+ }
+
+ // Grab privileges so we can access cross-domain windows
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
+ if ("load" in cmd) {
+ var testNum = cmd.load;
+ var win = wins[testNum];
+ win.childWin.x = testNum;
+ if (win.childWin.opener == win) {
+ if ("xsite" in cmd) {
+ var loc = r(window.location.href, "bug346659-opener-echoer.html");
+ } else {
+ var loc = r(win.location.href, "bug346659-opener-echoer.html");
+ }
+ } else {
+ if ("xsite" in cmd) {
+ var loc = r(window.location.href, "bug346659-parent-echoer.html");
+ } else {
+ var loc = r(win.location.href, "bug346659-parent-echoer.html");
+ }
+ }
+ win.childWin.location.href = loc;
+ wins[testNum] = null;
+ } else if ("write" in cmd) {
+ var testNum = cmd.write;
+ var win = wins[testNum];
+ win.childWin.x = testNum;
+ try {
+ if (win.childWin.opener == win) {
+ win.childWin.document.write('<script>window.opener.opener.postMessage(window.opener.testNum + " - " + window.x, "http://mochi.test:8888/"); window.opener.close(); window.close();<' + '/script>');
+ } else {
+ win.childWin.document.write('<script>window.parent.opener.postMessage(window.parent.testNum + " - " + window.x, "http://mochi.test:8888/"); window.parent.close();<' + '/script>');
+ }
+ } catch (e if (e.name == "SecurityError" && e.code == 18)) {
+ // Security error on cross-site write() is fine
+ if (win.childWin.opener == win) {
+ win.childWin.close();
+ }
+ win.close()
+ handleTestEnd();
+ }
+ wins[testNum] = null;
+ }
+ return true;
+}
+
+function messageReceiver(evt) {
+ // First try to detect a load/write command
+ if (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, "undefined", "Props on new window's child should 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, false);
+
+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");
+
+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_bug351601.html b/dom/tests/mochitest/bugs/test_bug351601.html
new file mode 100644
index 000000000..af7c2d590
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug351601.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=351601
+-->
+<head>
+ <title>Test for Bug 351601</title>
+ <script type="text/javascript" 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=351601">Mozilla Bug 351601</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 351601 **/
+
+var isOK = false;
+try {
+ var foo = navigator.buildID;
+ isOK = true;
+} catch (ex) {
+}
+ok(isOK, "navigator.buildID should never throw");
+
+
+</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 000000000..c35431a56
--- /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 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=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, false);
+ w.addEventListener("blur", failHandler, false);
+
+ aAction(w);
+
+ SimpleTest.executeSoon(function () {
+ originatingWindow.removeEventListener("focus", failHandler, false);
+ w.removeEventListener("blur", failHandler, false);
+
+ 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, false);
+ w.addEventListener("blur", failHandler, false);
+
+ /**
+ * 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, false);
+ w.removeEventListener("blur", failHandler, false);
+
+ 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("data:text/html,\<script>opener.focus();\<\/script>", test4);
+}
+
+function test4()
+{
+ focusShouldNotChange2("data:text/html,\<script>blur();\<\/script>", 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 000000000..e0a06338f
--- /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 type="text/javascript" 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 000000000..37b3041d9
--- /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 type="text/javascript" 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()" src="data:text/html,<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 000000000..be40c35f7
--- /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 type="text/javascript" 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 000000000..7567bacc5
--- /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 type="text/javascript" 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_bug38959.html b/dom/tests/mochitest/bugs/test_bug38959.html
new file mode 100644
index 000000000..a8d07d1a6
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug38959.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=38959
+-->
+<head>
+ <title>Test for Bug 38959</title>
+ <script type="application/javascript" 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=38959">Mozilla Bug 38959</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 38959 **/
+
+var newValue;
+
+function watcher(id, ol, ne)
+{
+ newValue = ne;
+ return ne;
+}
+
+function openWindow(url, crossOrigin)
+{
+ newValue = true;
+ var w = window.open(url);
+ w.watch("x", watcher);
+}
+
+function receiveMessage(evt)
+{
+ ok(newValue, "Watchpoints only allowed same-origin.");
+ if (evt.data == 1) {
+ openWindow("/tests/dom/tests/mochitest/bugs/iframe_bug38959-2.html");
+ }
+ else {
+ SimpleTest.finish();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+window.addEventListener("message", receiveMessage, false);
+
+openWindow("http://example.org/tests/dom/tests/mochitest/bugs/iframe_bug38959-1.html");
+
+</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 000000000..fbdcbfcdc
--- /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 type="text/javascript" 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 000000000..c9925269f
--- /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 type="application/javascript" 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 000000000..20dc53068
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug396843.html
@@ -0,0 +1,242 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=396843
+-->
+<head>
+ <title>Test for Bug 396843</title>
+ <script type="text/javascript" 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", "SharedObject")
+HTML_TAG("area", "Area")
+HTML_TAG("b", "Span")
+HTML_TAG("base", "Shared")
+HTML_TAG("basefont", "Span")
+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", "SharedObject")
+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.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
+ "window"));
+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 000000000..44703f949
--- /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 type="text/javascript" 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 000000000..5a5c5c190
--- /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 type="text/javascript" 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_bug406375.html b/dom/tests/mochitest/bugs/test_bug406375.html
new file mode 100644
index 000000000..2cd459ffa
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug406375.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=406375
+-->
+<head>
+ <title>Test for Bug 406375</title>
+ <script type="application/javascript" 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=406375">Mozilla Bug 406375</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 406375 **/
+
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+ if ("showModalDialog" in window) {
+ window.showModalDialog("file_bug406375.html");
+ }
+ ok(true, "This test should not hang");
+
+ SimpleTest.finish();
+}
+
+</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 000000000..883e52bb4
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug414291.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=414291
+-->
+<head>
+ <title>Test for Bug 414291</title>
+ <script type="text/javascript" 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;
+var result3 = 0;
+
+window.open("data:text/html,<html><body onload='close(); opener.result1 = 1;'>", "w1");
+is(result1, 0, "window should not be opened either as modal or loaded synchronously.");
+
+window.open("data:text/html,<html><body onload='close(); opener.result2 = 2;'>", "w2", "modal=yes");
+is(result2, 0, "window should not be opened either as modal or data loaded synchronously.");
+
+if (window.showModalDialog) {
+ result3 = window.showModalDialog("data:text/html,<html><body onload='close(); returnValue = 3;'>");
+ is(result3, 3, "window should be opened as modal.");
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/bugs/test_bug427744.html b/dom/tests/mochitest/bugs/test_bug427744.html
new file mode 100644
index 000000000..faf7fda7c
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug427744.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=427744
+-->
+<head>
+ <title>Test for Bug 427744</title>
+ <script type="text/javascript" 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=427744">Mozilla Bug 427744</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 427744 **/
+
+var firstPlugin = navigator.plugins["Test Plug-in"];
+ok(firstPlugin, "Should have seen the test plugin");
+is(firstPlugin.version, "1.0.0.0", "Should have seen the right test plugin version");
+
+var secondPlugin = navigator.plugins["Second Test Plug-in"];
+ok(secondPlugin, "Should have seen the second test plugin");
+is(secondPlugin.version, "1.0.0.0", "Should have seen the right second test plugin version");
+
+</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 000000000..900928d85
--- /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 type="text/javascript" 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 src="data:text/html,<meta http-equiv='Content-Language' content='ja-JP'><base href='http://www.mozilla.org'><p>asdf"></iframe>;
+ <iframe id=htmlquirks src="data:text/html;charset=ISO-8859-2,<html><body><div></div></body></html>"></iframe>
+ <iframe id=htmlstd src="data:text/html;charset=ISO-8859-3,<!DOCTYPE html><html><body><div></div></body></html>"></iframe>
+ <iframe id=textplain src="data:text/plain;charset=ISO-8859-4,asdf%0Azxcv%0A"></iframe>
+ <iframe id=xhtmlstd src="data:application/xhtml+xml;charset=ISO-8859-5,<!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml'><body><div></div></body></html>"></iframe>
+ <iframe id=xmlstd src="data:image/svg+xml;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 000000000..0dadb2bd2
--- /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 type="text/javascript" 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_bug437361.html b/dom/tests/mochitest/bugs/test_bug437361.html
new file mode 100644
index 000000000..ecc2cb08d
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug437361.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=437361
+-->
+<head>
+ <title>Test for Bug 437361</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+ <script class="testbody" type="text/javascript">
+
+ /** Test for Bug 437361 **/
+
+ function testModalDialogBlockedCleanly() {
+ is(true, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
+ var rv = window.showModalDialog( // should be blocked without exception
+ "data:text/html,<html><body onload='close(); returnValue = 1;' /></html>");
+ is(rv, null, "Modal dialog opened unexpectedly.");
+ }
+
+ function testModalDialogAllowed() {
+ is(false, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
+ var rv = window.showModalDialog( // should not be blocked this time
+ "data:text/html,<html><body onload='close(); returnValue = 1;' /></html>");
+ is(rv, 1, "Problem with modal dialog returnValue.");
+ }
+
+ function testOtherExceptionsNotTrapped() {
+ is(false, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
+ window.showModalDialog('about:config'); // forbidden by SecurityCheckURL
+ }
+
+ function test(disableOpen, exceptionExpected, testFn, errorMsg) {
+ if ("showModalDialog" in window) {
+ var oldPrefVal = SpecialPowers.getBoolPref("dom.disable_open_during_load");
+ try {
+ SpecialPowers.setBoolPref("dom.disable_open_during_load", disableOpen);
+ testFn();
+ ok(!exceptionExpected, errorMsg);
+ } catch (_) {
+ ok(exceptionExpected, errorMsg);
+ }
+ finally {
+ SpecialPowers.setBoolPref("dom.disable_open_during_load", oldPrefVal);
+ }
+ } else {
+ ok(true, "nothing to do in e10s mode");
+ }
+ }
+
+ test(true, false, testModalDialogBlockedCleanly,
+ "Blocked showModalDialog caused an exception.");
+
+ test(false, false, testModalDialogAllowed,
+ "showModalDialog was blocked even though dom.disable_open_during_load was false.");
+
+ test(false, true, testOtherExceptionsNotTrapped,
+ "Incorrectly suppressed insecure showModalDialog exception.");
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=437361">Mozilla Bug 437361</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_bug440572.html b/dom/tests/mochitest/bugs/test_bug440572.html
new file mode 100644
index 000000000..a86f14137
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug440572.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=440572
+-->
+<head>
+ <title>Test for Bug 440572</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=440572">Mozilla Bug 440572</a>
+
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 440572 **/
+
+var messages = [];
+
+function receiveMessage(e)
+{
+ is(e.origin, "http://example.org", "wrong sender!");
+ messages.push(e.data);
+}
+
+window.addEventListener("message", receiveMessage, false);
+
+function runtests()
+{
+ is(messages.length, 3, "received the right number of messages.");
+ is(messages[0], "success", "test in frame failed.");
+ isnot(messages[1], "success", "parent[\"content\"] should be the WebIDL property of Window.");
+ isnot(messages[2], "success", "parent[\"dump\"] 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="content" 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>
+</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 000000000..210a60d82
--- /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 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=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, false);
+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, false);
+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; }, false);
+} 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 000000000..371478f1b
--- /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 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=458091">Mozilla Bug 458091</a>
+
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<a id="testlink1" target="_blank" href="javascript:window.opener.finish(sessionStorage['testItem']);window.close();">Javascript Link</a>
+<a id="testlink2" target="_blank" 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 > 0) {
+ 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 000000000..4bcdca898
--- /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 type="application/javascript" 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.parentNode.removeChild(ifr2);
+ 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 000000000..cd5610191
--- /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 type="application/javascript" 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_bug479143.html b/dom/tests/mochitest/bugs/test_bug479143.html
new file mode 100644
index 000000000..03db4ddea
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug479143.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=479143
+-->
+<head>
+ <title>Test for Bug 411103</title>
+ <script type="text/javascript" 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=479143">Mozilla Bug 479143</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+ SimpleTest.waitForExplicitFinish();
+
+ setTimeout(function() {
+ if ("showModalDialog" in window) {
+ var interval = setInterval(function() { var i = 0; i++; }, 10);
+
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "test_bug479143.html", false);
+ xhr.send(null);
+
+ window.showModalDialog("javascript:" +
+ "setTimeout(function() { window.close(); }, 1000);",
+ null);
+
+ clearInterval(interval);
+ }
+
+ ok(true, "did not crash");
+
+ SimpleTest.finish();
+ }, 0);
+
+</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 000000000..2fdb16051
--- /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 type="application/javascript" 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, false);
+attr.dispatchEvent(event);
+is(eventCount, 1, "Should have fired an event!");
+attr.removeEventListener(expectedType, listener, false);
+
+var df = document.createDocumentFragment();
+expectedTarget = df;
+df.addEventListener(expectedType, listener, false);
+df.dispatchEvent(event);
+is(eventCount, 2, "Should have fired an event!");
+df.removeEventListener(expectedType, listener, false);
+
+</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 000000000..162f0a361
--- /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 type="application/javascript" 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 000000000..e47faab59
--- /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 type="application/javascript" 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 000000000..98cd530a3
--- /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 type="application/javascript" 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_bug504862.html b/dom/tests/mochitest/bugs/test_bug504862.html
new file mode 100644
index 000000000..713165bc3
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug504862.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=504862
+-->
+<head>
+ <title>Test for Bug 504862</title>
+ <script type="text/javascript" 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=504862">Mozilla Bug 504862</a>
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 504862 **/
+SimpleTest.waitForExplicitFinish();
+function onMsgRcv(event)
+{
+ is(event.data, "args: undefined", "Unexpected cross origin dialog arguments.");
+}
+
+function runTest() {
+ if ("showModalDialog" in window) {
+ window.addEventListener("message", onMsgRcv, false);
+
+ var result = window.showModalDialog("file_bug504862.html", "my args");
+ // NB: We used to clear returnValue on each navigation, but now we do a
+ // security check on access, so we can safely make returnValue live on
+ // the browsing context, per spec.
+ is(result, 3, "window sees previous dialog documents return value.");
+
+ result = window.showModalDialog("http://test1.example.com/tests/dom/tests/mochitest/bugs/file_bug504862.html", "my args");
+
+ is(result, undefined, "Able to see return value from cross origin dialog.");
+ } else {
+ ok(true, "nothing to do in e10s mode");
+ }
+
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</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 000000000..81eb62e81
--- /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 type="application/javascript" 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 000000000..2525d5b63
--- /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 type="application/javascript" 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 000000000..40b5c452b
--- /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 type="application/javascript" 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 000000000..9c9506045
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug534149.html
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=534149
+-->
+<head>
+ <title>Test for Bug 534149</title>
+ <script type="application/javascript" 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;
+
+ var util = SpecialPowers.getDOMWindowUtils(win);
+ return [util.outerWindowID, util.currentInnerWindowID];
+}
+
+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;
+var outerWindowDestroyID;
+
+var outerObserver = {
+ observe: function(id) {
+ outerWindowDestroyID =
+ SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
+ }
+};
+var innerObserver = {
+ observe: function(id) {
+ innerWindowDestroyID =
+ SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
+ }
+};
+
+function removeFrame(iframe) {
+ SpecialPowers.addObserver(outerObserver, "outer-window-destroyed", false);
+ SpecialPowers.addObserver(innerObserver, "inner-window-destroyed", false);
+
+ iframe.parentNode.removeChild(iframe);
+}
+
+removeFrame(i1);
+SimpleTest.waitForExplicitFinish();
+SimpleTest.executeSoon(function() {
+ is(innerWindowDestroyID, i1inner, "inner window of frame 1 should be destroyed");
+ is(outerWindowDestroyID, i1outer, "outer window of frame 1 should be destroyed");
+ SpecialPowers.removeObserver(outerObserver, "outer-window-destroyed");
+ SpecialPowers.removeObserver(innerObserver, "inner-window-destroyed");
+ SimpleTest.finish();
+});
+
+
+</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 000000000..1ce8ff1b4
--- /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 type="text/javascript" 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 000000000..87fcd4f58
--- /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 type="application/javascript" 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 000000000..3e2cba806
--- /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 type="text/javascript" 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 000000000..836ff5da2
--- /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 type="application/javascript" 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 000000000..1500ee113
--- /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 type="application/javascript" 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 000000000..09e2a0f99
--- /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() {}, false);
+ } catch (e) {
+ exception = e;
+ }
+ </script>
+ <title>Test for Bug 563487</title>
+ <script type="application/javascript" 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 000000000..9590a6e63
--- /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 type="application/javascript" 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 000000000..a174d589b
--- /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 type="application/javascript" 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, false);
+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 000000000..8dbb9d723
--- /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 type="application/javascript" 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 000000000..60824e7d9
--- /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 type="text/javascript" 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 000000000..370d40b79
--- /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 type="text/javascript" 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_bug597809.html b/dom/tests/mochitest/bugs/test_bug597809.html
new file mode 100644
index 000000000..71fb8ac78
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug597809.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=597809
+-->
+<head>
+ <title>Test for Bug 597809</title>
+ <script type="application/javascript" 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=597809">Mozilla Bug 597809</a>
+<p id="display"></p>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 597809 **/
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.addCategoryEntry("JavaScript-global-property", "testSNSM", "@mozilla.org/xmlextras/xmlhttprequest;1",
+ false, true);
+
+SimpleTest.executeSoon(function () {
+ ok(window.testSNSM, "testSNSM should return an object");
+ // The category entry must be removed before finishing the test,
+ // otherwise it will affect all following tests in the test suite.
+ SpecialPowers.deleteCategoryEntry("JavaScript-global-property", "testSNSM", false);
+ SimpleTest.finish();
+});
+
+
+</script>
+</pre>
+</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 000000000..4c6ce967d
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug61098.html
@@ -0,0 +1,339 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=61098
+-->
+<head>
+ <title>Test for Bug 61098</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" 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, mockPromptFactoryRegisterer;
+
+var promptState;
+
+function registerMockPromptService()
+{
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ var XPCOMUtils = SpecialPowers.Cu.import("resource://gre/modules/XPCOMUtils.jsm").XPCOMUtils;
+ var Ci = SpecialPowers.Ci;
+
+ function MockPrompt(aDOMWindow) {
+ this.domWindow = aDOMWindow;
+ }
+
+ MockPrompt.prototype = {
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]),
+
+ domWindow : null,
+
+ _toggleModalState: function()
+ {
+ // 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: function(aDialogTitle, aText)
+ {
+ this._toggleModalState();
+ promptState = {method: "alert",
+ parent: this.domWindow,
+ title: aDialogTitle,
+ msg: aText
+ };
+ },
+
+ alertCheck: function(aDialogTitle, aText, aCheckMsg, aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "alertCheck",
+ parent: this.domWindow,
+ title: aDialogTitle,
+ msg: aText,
+ checkMsg: aCheckMsg,
+ checkState: aCheckState
+ };
+
+ SpecialPowers.wrap(aCheckState).value = true;
+ },
+
+ confirm: function(aDialogTitle, aText)
+ {
+ this._toggleModalState();
+ promptState = {method: "confirm",
+ parent: this.domWindow,
+ title: aDialogTitle,
+ msg: aText
+ };
+
+ return true;
+ },
+
+ confirmCheck: function(aDialogTitle, aText, aCheckMsg, aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "confirmCheck",
+ parent: this.domWindow,
+ title: aDialogTitle,
+ msg: aText,
+ checkMsg: aCheckMsg,
+ checkState: aCheckState
+ };
+
+ SpecialPowers.wrap(aCheckState).value = true;
+
+ return true;
+ },
+
+ confirmEx: function(aDialogTitle, aText, aButtonFlags,
+ aButton0Title, aButton1Title, aButton2Title,
+ aCheckMsg, aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "confirmCheck",
+ parent: this.domWindow,
+ title: aDialogTitle,
+ msg: aText,
+ checkMsg: aCheckMsg,
+ checkState: aCheckState
+ };
+
+ if (aCheckMsg != null)
+ SpecialPowers.wrap(aCheckState).value = true;
+
+ return 0;
+ },
+
+ prompt: function(aDialogTitle, aText, aValue, aCheckMsg,
+ aCheckState)
+ {
+ this._toggleModalState();
+ promptState = {method: "prompt",
+ parent: 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: XPCOMUtils.generateQI([Ci.nsIPromptFactory, Ci.nsIPromptService]),
+
+ getPrompt: function(aDOMWindow, aIID)
+ {
+ return new MockPrompt(aDOMWindow);
+ },
+
+ alert: function(aParent, aDialogTitle, aText)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.alert(aDialogTitle, aText);
+ },
+
+ alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.alertCheck(aDialogTitle, aText, aCheckMsg, aCheckState);
+ },
+
+ confirm: function(aParent, aDialogTitle, aText)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.confirm(aDialogTitle, aText);
+ },
+
+ confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg,
+ aCheckState)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.confirmCheck(aDialogTitle, aText, aCheckMsg, aCheckState);
+ },
+
+ confirmEx: function(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: function(aParent, aDialogTitle, aText, aValue, aCheckMsg,
+ aCheckState)
+ {
+ var prompt = new MockPrompt(aParent);
+ return prompt.prompt(aDialogTitle, aText, aValue, aCheckMsg, aCheckState);
+ },
+
+ };
+
+ mockPromptServiceRegisterer =
+ new MockObjectRegisterer("@mozilla.org/embedcomp/prompt-service;1",
+ MockPromptService);
+ mockPromptFactoryRegisterer =
+ new MockObjectRegisterer("@mozilla.org/prompter;1",
+ MockPromptService);
+
+ mockPromptServiceRegisterer.register();
+ mockPromptFactoryRegisterer.register();
+};
+
+var expectedState;
+
+function runtests()
+{
+ SpecialPowers.pushPrefEnv({'set': [["dom.successive_dialog_time_limit", 3]]},
+ runtestsInner);
+}
+
+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();
+
+ // Test that confirm() works normally and then gets blocked on the
+ // second call.
+ w = window.open();
+ 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();
+
+ // Test that prompt() works normally and then gets blocked on the
+ // second call.
+ w = window.open();
+ 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();
+
+ // Test that showModalDialog() works normally and then gets blocked
+ // on the second call.
+ if (window.showModalDialog) {
+ w = window.open();
+ w.showModalDialog("data:text/html,%3Cscript>window.close();%3C/script>")
+ is (promptState, void(0), "Wrong prompt state");
+
+ try {
+ w.showModalDialog("data:text/html,%3Cscript>window.close();%3C/script>")
+ ok(false, "showModalDialog call should throw an exception");
+ } catch(e) {
+ is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception");
+ }
+ is (promptState.method, "confirm", "Wrong prompt method called");
+ is (promptState.parent, w, "Wrong confirm parent");
+ is (promptState.msg, "Prevent this page from creating additional dialogs",
+ "Wrong confirm message");
+ promptState = void(0);
+
+ w.close();
+ }
+
+ mockPromptFactoryRegisterer.unregister();
+ 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 000000000..fc55e54f4
--- /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 type="text/javascript" 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 000000000..9e5a2a3e1
--- /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 type="application/javascript" 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 000000000..71977c417
--- /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 type="application/javascript" 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 000000000..b9d10cb21
--- /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 type="text/javascript" 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("data:text/html,1");
+ doNext();
+ return;
+ case 2:
+ w.location = "data:text/html,2";
+ 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, false);
+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 000000000..2d5f11661
--- /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 type="application/javascript" 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_bug641552.html b/dom/tests/mochitest/bugs/test_bug641552.html
new file mode 100644
index 000000000..ab76c74a3
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug641552.html
@@ -0,0 +1,88 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=641552
+-->
+<head>
+ <title>Test for Bug 641552</title>
+ <script type="application/javascript" src="/MochiKit/packed.js"></script>
+ <script type="application/javascript" 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=641552">Mozilla Bug 641552</a>
+<p id="display"></p>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 641552 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var contractId = "@mozilla.org/xmlextras/xmlhttprequest;1";
+var categoryEntries = [
+ {category: "JavaScript-global-property", entry: "randomname", contractId: contractId},
+];
+
+function addCategoryEntries(func) {
+ for (var categoryEntry of categoryEntries) {
+ SpecialPowers.addCategoryEntry(categoryEntry.category, categoryEntry.entry, categoryEntry.contractId,
+ false, true);
+ }
+ SimpleTest.executeSoon(func);
+}
+
+function removeCategoryEntries(func) {
+ for (var categoryEntry of categoryEntries) {
+ SpecialPowers.deleteCategoryEntry(categoryEntry.category, categoryEntry.entry, false);
+ }
+ SimpleTest.executeSoon(func);
+}
+
+function checkNamesPresent() {
+ ok(window.randomname, "window.randomname should return an object");
+}
+
+function checkNamesAbsent() {
+ ok(!window.randomname, "window.randomname should return undefined");
+}
+
+// Ensure the initial state
+checkNamesAbsent();
+
+addCategoryEntries(function test1() {
+ ok(window.randomname, "window.randomname should return an object");
+
+ delete window.randomname;
+
+ // The delete opertor should have no effect as long as the category entry is registered.
+ checkNamesPresent();
+
+ removeCategoryEntries(test2);
+});
+
+function test2() {
+ // The object should be cached on the global/navigator object once accessed.
+ checkNamesPresent();
+
+ delete window.randomname;
+
+ // Now the delete opertor should have the effect.
+ checkNamesAbsent();
+
+ addCategoryEntries(function() {
+ removeCategoryEntries(test3);
+ });
+}
+
+function test3() {
+ // The object should not be cached until the first access.
+ checkNamesAbsent();
+
+ SimpleTest.finish();
+}
+
+</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 000000000..635c4c5db
--- /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 type="application/javascript" 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 000000000..2a6afdf43
--- /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 type="text/javascript" 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 000000000..bbbb0bb08
--- /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 type="application/javascript" 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 000000000..447c9ac64
--- /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 type="application/javascript" 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 000000000..a48255cd1
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug665548.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=665548
+-->
+<head>
+ <title>Test for Bug 665548</title>
+ <script type="application/javascript" src="/MochiKit/packed.js"></script>
+ <script type="application/javascript" 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 000000000..885e2e900
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug684544.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=
+-->
+<head>
+ <title>Test for Bug </title>
+ <script type="application/javascript" 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.parentNode.removeChild(f);
+
+// 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");
+is(win.location, null, "There should be no location object now");
+
+// 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;
+}
+todo(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");
+is(win.location, null,
+ "There should be no location object for real after the set");
+
+</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 000000000..6e3d8ba11
--- /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 type="application/javascript" 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.indexOf("" + j) >= 0, "Enumerating hit all numeric properties");
+ok(properties.indexOf("item") >= 0, "Enumerating hit 'item' from the prototype");
+ok(properties.indexOf("length") >= 0, "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 000000000..c8a4fbfe5
--- /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 type="application/javascript" 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 000000000..70a002bb9
--- /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 type="application/javascript" 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: function() { return it; },
+});
+Object.defineProperty(Object.getPrototypeOf(l), "foopy",
+{
+ get: function() { 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 000000000..18d197e1e
--- /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 type="text/javascript" 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()" src="data:text/html,<script>navigator</script>"></iframe>
+</pre>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/bugs/test_bug735237.html b/dom/tests/mochitest/bugs/test_bug735237.html
new file mode 100644
index 000000000..e1a25a425
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug735237.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=735237
+-->
+<head>
+ <title>Test for Bug 735237</title>
+ <script type="application/javascript" 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=735237">Mozilla Bug 735237</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 735237 **/
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_showModalDialog", true]]}, function() {
+ var caughtException = false;
+ try {
+ window.showModalDialog("http://example.com/");
+ } catch (e) {
+ caughtException = true;
+ }
+ ok(caughtException, "showModalDialog should throw an exception");
+ SimpleTest.finish();
+});
+
+</script>
+</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 000000000..2cbbf3654
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug739038.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=739038
+-->
+<head>
+ <title>Test for Bug 739038</title>
+ <script type="application/javascript" 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.disable_window_print", true]]}, function() {
+ var caughtException = false;
+ try {
+ window.print();
+ } catch (e) {
+ caughtException = true;
+ }
+ ok(caughtException, "window.print should throw an exception");
+ SimpleTest.finish();
+});
+
+</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 000000000..7e6dcc4fe
--- /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 type="application/javascript" 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 000000000..39e978dda
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug743615.html
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=743615
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 743615</title>
+ <script type="application/javascript" 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: imageData,
+ pattern: 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');
+
+ // We're not spec compliant on this yet.
+ todo_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: imageData, pattern: 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_bug750051.html b/dom/tests/mochitest/bugs/test_bug750051.html
new file mode 100644
index 000000000..181233a41
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug750051.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=750051
+-->
+<head>
+ <title>Test for Bug 750051</title>
+ <script type="application/javascript" 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=750051">Mozilla Bug 750051</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 750051 **/
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_find", true]]}, function() {
+ var caughtException = false;
+ try {
+ window.find();
+ } catch (e) {
+ caughtException = true;
+ }
+ ok(caughtException, "window.find should throw an exception");
+ 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 000000000..9cbbc4b62
--- /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 type="application/javascript" 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 000000000..f272fcb3e
--- /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 type="application/javascript" 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: 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 000000000..71df15ea3
--- /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 type="application/javascript" 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 000000000..f76bb5125
--- /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 type="application/javascript" 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 ScreenPrototype]",
+ "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 ScreenPrototype]",
+ "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 000000000..15748786c
--- /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 type="application/javascript" 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 000000000..0f5c6f28f
--- /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 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 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 000000000..140611c75
--- /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 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 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.wrap(is));
+ SpecialPowers.setWrapped(sb, 'ok', SpecialPowers.wrap(ok));
+ 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 000000000..889ed6147
--- /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 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 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 000000000..d86683669
--- /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 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 862540 **/
+ window.status = 5;
+ is(window.status, "5", "Should be able to get 5");
+
+ window.status = { toString: function() { 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_bug876098.html b/dom/tests/mochitest/bugs/test_bug876098.html
new file mode 100644
index 000000000..66292cb89
--- /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 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 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 000000000..8bc0eba1e
--- /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 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 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 000000000..fcf345ead
--- /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 type="application/javascript" 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.parentNode.removeChild(ifr);
+ 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 000000000..d821384a8
--- /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 type="text/javascript" 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 000000000..8ca001f9a
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_errorReporting.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1070842
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1070842</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 error reporting behavior. **/
+ SimpleTest.waitForExplicitFinish();
+
+ function testErrorReportingHelper(f, rgxp, preventDefault) {
+ return new Promise(function(resolve, reject) {
+ window.addEventListener('error', function l(e) {
+ window.removeEventListener('error', l);
+ 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);
+ });
+
+ // 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_onerror_message.html b/dom/tests/mochitest/bugs/test_onerror_message.html
new file mode 100644
index 000000000..591928cd8
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_onerror_message.html
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=743049
+-->
+<head>
+ <meta charset="UTF-8">
+ <title>Test for Bug 743049</title>
+ <script type="application/javascript" 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]" },
+{ name: "DuckError", message: "foo", filename: "bar", lineNumber: 123 },
+{ name: "", message: "uncaught exception: [object Object]" },
+{ name: "", message: "foo", filename: "baz", lineNumber: 123 },
+{ name: "", message: "uncaught exception: [object Object]" },
+{ name: "InvalidStateError", message: "XMLHttpRequest state must not be 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");
+ is(undefined, expected[counter].filename, counter + " catch filename");
+ is(undefined, expected[counter].lineNumber, counter + " catch lineno");
+ }
+ 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 || 0, counter + " onerror lineno");
+ postMessage(++counter, origin);
+ return true;
+};
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</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 000000000..0e6149126
--- /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 type="application/javascript" 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 000000000..0762e9231
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_resize_move_windows.html
@@ -0,0 +1,378 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=565541
+-->
+<head>
+ <title>Test for Bug 565541</title>
+ <script type="application/javascript" 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 type="application/javascript">
+
+/** 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.innerWidth;
+ previousHeight = window.innerHeight;
+}
+
+function restoreValues()
+{
+ window.screenX = previousX;
+ window.screenY = previousY;
+ window.innerWidth = previousWidth;
+ window.innerHeight = 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) {
+ return new Promise(function(resolve, reject) {
+ function doMagic() {
+ if (condition() || times == 0) {
+ test();
+ resolve();
+ return;
+ }
+
+ setTimeout(doMagic, 0, condition, test, times - 1);
+ }
+
+ 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.innerWidth = newWidth;
+ aWindow.innerHeight = newHeight;
+
+ 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.screenX = newX;
+ aWindow.screenY = newY;
+
+ aWindow.moveTo(newX, newY);
+
+ aWindow.moveBy(newX - aWindow.screenX,
+ newY - aWindow.screenY);
+
+ /**
+ * Outer width/height checks.
+ */
+ 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)
+{
+ // 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.indexOf('Linux') != -1) {
+ 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.indexOf('Linux') != -1) {
+ // 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.innerWidth;
+ prevHeight = aWindow.innerHeight;
+ aWindow.innerWidth = getNewWidth(aWindow);
+ aWindow.innerHeight = 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.screenX = getNewX(aWindow);
+ aWindow.screenY = getNewY(aWindow);
+ return hitEventLoop(posChangeCondition, posChangeTest, hits);
+ })
+ .then(function() {
+ 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.outerWidth = oWidth * 2;
+ aWindow.outerHeight = oHeight * 2;
+ return hitEventLoop(outerChangeCondition, outerChangeTest, hits);
+ })
+ .then(function() {
+ let origWidth = oWidth;
+ let origHeight = oHeight;
+
+ oWidth = aWindow.outerWidth;
+ oHeight = aWindow.outerHeight;
+
+ aWindow.outerWidth = origWidth;
+ aWindow.outerHeight = 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() {
+ // 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("data:text/html,<script>" +
+ "function check(next) {" +
+ " var is_range = function(aTest, aValue, aRange, aMsg) {" +
+ " window.opener.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, 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>", '',
+ '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("data:text/html,<script>" +
+ "function check(next) {" +
+ " window.opener.checkChangeIsDisabled(window).then(next);" +
+ "} <\/script>", '', '');
+
+ 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 000000000..90767e6fb
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_sizetocontent_clamp.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=764240
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 764240</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=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.indexOf("Win") == -1 ? 5 : 20;
+
+// Windows 8 has a minimum 122 pixel inner window width due to
+// outer window chrome.
+var isWin8 = (navigator.userAgent.indexOf("Windows NT 6.2") != -1);
+
+var innerWidthMin = (isWin8 ? 120 : 100);
+var innerWidthMax = (isWin8 ? 125 : 100);
+
+var isExecuted = false;
+
+function test() {
+ var w = window.open('data:text/html,null', null, 'width=300,height=300');
+
+ SimpleTest.waitForFocus(function() {
+ w.onresize = function() {
+
+ 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 000000000..c24e6921f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_toJSON.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=760851
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 760851</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 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) {
+ 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 000000000..966125906
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_window_bar.html
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=642338
+-->
+<head>
+ <title>Test for Bug 642338</title>
+ <script type="text/javascript" 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
+
+*/
+
+var numWindows = 0;
+
+/* Called when our popup loads. */
+function testWindow(w)
+{
+
+ // If dom.disable_window_open_feature.X is true, then we can't disable
+ // feature X when we call window.open from content. So to check that our popup
+ // has the right bars shown, we need to check that it obeys first the pref
+ // and then the arguments to window.open, if applicable.
+
+ function checkFeature(feature, prefname) {
+ if (prefname === undefined)
+ prefname = feature;
+
+ if (SpecialPowers.getBoolPref('dom.disable_window_open_feature.' + prefname)) {
+ is(w[feature].visible, true, feature + ' should always be true.');
+ }
+ else {
+ // w.location.search == '?true' if we expect the bars to be on, and
+ // '?false' otherwise. By default, no bars are enabled, so '?default'
+ // can be handled the same way as '?false'.
+ var enabled = w.location.search == '?true';
+ is(w[feature].visible, enabled, feature + ' should follow window.open settings.');
+ }
+ }
+
+ checkFeature('menubar');
+ checkFeature('toolbar');
+ checkFeature('personalbar');
+ checkFeature('statusbar', 'status');
+ checkFeature('locationbar', 'location');
+
+ w.close();
+
+ numWindows++;
+ if (numWindows == 3) {
+ // We're done!
+ SimpleTest.finish();
+ }
+
+}
+
+SimpleTest.waitForExplicitFinish();
+
+// These will call back into testWindow when they open.
+
+var allBarsWindow =
+ window.open('file_window_bar.html?true', 'all-bars',
+ 'menubar=yes,toolbar=yes,location=yes,' +
+ 'personalbar=yes,status=yes,scrollbars=yes',
+ true);
+
+var noBarsWindow =
+ window.open('file_window_bar.html?false', 'no-bars',
+ 'menubar=no,toolbar=no,location=no,' +
+ 'personalbar=no,status=no,scrollbars=no',
+ false);
+
+var defaultWindow =
+ window.open('file_window_bar.html?default', 'default-bars',
+ 'width=500,height=500', false);
+
+</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 000000000..07b98ea7e
--- /dev/null
+++ b/dom/tests/mochitest/bugs/utils_bug260264.js
@@ -0,0 +1,60 @@
+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, false);
+ try { sendMouseEvent({ type: event }, element.id) }
+ finally { element.removeEventListener(event, unique_handler, false) }
+}
+
+/**
+ * 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 openedWindowID =
+ SpecialPowers.getDOMWindowUtils(win).outerWindowID;
+ promises.push((function(openedWindow) {
+ return new Promise(function(resolve) {
+ let observer = {
+ observe(subject) {
+ let wrapped = SpecialPowers.wrap(subject);
+ let winID = wrapped.QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
+ if (winID == openedWindowID) {
+ SpecialPowers.removeObserver(observer, "outer-window-destroyed");
+ SimpleTest.executeSoon(resolve);
+ }
+ }
+ };
+
+ SpecialPowers.addObserver(observer, "outer-window-destroyed", false);
+ });
+ })(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 000000000..9a6f4af86
--- /dev/null
+++ b/dom/tests/mochitest/bugs/utils_bug743615.js
@@ -0,0 +1,25 @@
+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/worker_bug743615.js b/dom/tests/mochitest/bugs/worker_bug743615.js
new file mode 100644
index 000000000..22c9f239f
--- /dev/null
+++ b/dom/tests/mochitest/bugs/worker_bug743615.js
@@ -0,0 +1,38 @@
+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: statusMessage, imageData: imageData,
+ pattern: pattern });
+}
diff --git a/dom/tests/mochitest/chrome/489127.html b/dom/tests/mochitest/chrome/489127.html
new file mode 100644
index 000000000..5e20345cf
--- /dev/null
+++ b/dom/tests/mochitest/chrome/489127.html
@@ -0,0 +1,200 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIDOMWindowUtils::nodesFromRect test - bug 489127</title>
+ <script type="text/javascript" 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;version=1.8">
+
+ var SimpleTest = window.opener.SimpleTest;
+ function ok() { window.opener.ok.apply(window.opener, arguments); }
+ function done() { window.opener.done.apply(window.opener, arguments); }
+ let e = {};
+
+ let dwu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils);
+
+ /*
+ nsIDOMNodeList nodesFromRect(in float aX,
+ in float aY,
+ in float aTopSize,
+ in float aRightSize,
+ in float aBottomSize,
+ in float aLeftSize,
+ in boolean aIgnoreRootScrollFrame,
+ in boolean aFlushLayout);
+
+ */
+
+ function check(x, y, top, right, bottom, left, list) {
+ let nodes = dwu.nodesFromRect(x, y, top, right, bottom, left, true, false);
+
+ list.push(e.body);
+ list.push(e.html);
+
+ if (nodes.length != list.length) {
+ ok(false, "Different number of nodes 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 + " for rect " +
+ "[" + 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.getElementsByTagName("html")[0];
+ ['h1', 'd1', 'd2', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'span',
+ 'a1', 'a2', 'a3', 'transf', 'iframe1', 'body'].forEach(function(a) {
+ e[a] = document.getElementById(a);
+ });
+
+ window.scrollTo(0, 0);
+
+ // Top, Right, Bottom, Left directions:
+ check(53, 71, 0, 0, 0, 0, []);
+ check(53, 71, 10, 0, 0, 0, [e.h1]);
+ check(53, 71, 0, 10, 0, 0, [e.p3]);
+ check(53, 71, 0, 0, 10, 0, [e.d1]);
+ check(152, 105, 0, 0, 0, 10, [e.d1]);
+ check(152, 105, 10, 10, 10, 10, [e.p4, e.p3, e.d1]);
+
+ // e.p1 is invisible and shouldn't appear:
+ check(153,193,0,0,0,0,[e.p5]);
+ check(153,193,0,20,0,20, [e.p5, e.d2]);
+
+ // Precise pixel checks:
+ check(144, 183, 0, 0, 0, 0, []);
+ check(144, 183, 0, 0, 1, 0, [e.p5]);
+ check(144, 183, 0, 0, 0, 1, [e.d2]);
+ check(144, 183, 0, 0, 1, 1, [e.p5, e.d2]);
+ check(77, 240, 0, 0, 0, 0, [e.p2]);
+ check(77, 240, 1, 0, 0, 0, [e.p5, e.p2]);
+ check(77, 240, 0, 0, 1, 0, [e.span, e.p2]);
+ check(77, 240, 1, 0, 1, 0, [e.p5, e.span, e.p2]);
+
+ // Expanding area checks:
+ check(39, 212, 0, 0, 0, 0, []);
+ check(39, 212, 10, 0, 0, 0, [e.d2]);
+ check(39, 212, 0, 0, 10, 0, [e.p2]);
+ check(39, 212, 10, 1, 30, 0, [e.d2, e.p2]);
+ check(39, 212, 10, 5, 30, 0, [e.span, e.d2, e.p2]);
+ check(39, 212, 10, 15, 30, 0, [e.p5, e.span, e.d2, e.p2]);
+
+ // Elements inside iframe shouldn't be returned:
+ check(15, 410, 0, 30, 50, 0, [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, [e.a1.firstChild, e.a1, e.p6]);
+ check(x1, y1, 0, 0, y3 - y1, 0, [e.a3.firstChild, e.a3, e.a1.firstChild, e.a1, e.p6]);
+ check(x1, y1, 0, xt - x1, 0, 0, [e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
+ check(x1, y1, 0, x2 - x1, 0, 0, [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, [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, []);
+ check(61, 671, 0, 30, 0, 10, [e.transf]);
+ check(61, 671, 0, 30, 90, 10, [e.transf.firstChild, e.transf]);
+
+ done();
+
+ }
+
+ function getCenterFor(element) {
+ let rect = element.getBoundingClientRect();
+ return [(rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2];
+ }
+
+ addLoadEvent(doTest);
+</script>
+<style type="text/css">
+
+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);
+}
+
+#decimal {
+ position: relative;
+ left: 0.5px;
+ top: 50.5px;
+}
+</style>
+</head>
+<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>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xul b/dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xul
new file mode 100644
index 000000000..3faaf8fd5
--- /dev/null
+++ b/dom/tests/mochitest/chrome/DOMWindowCreated_chrome.xul
@@ -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.opener.wrappedJSObject.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.createElement("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 000000000..acb6b0582
--- /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/MozDomFullscreen_chrome.xul b/dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul
new file mode 100644
index 000000000..7c36696b9
--- /dev/null
+++ b/dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul
@@ -0,0 +1,110 @@
+<?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 that "MozDOMFullscreen:*" events are dispatched to chrome on documents that use DOM fullscreen.
+
+ Test Description:
+
+ This chrome window has a browser. The browser's contentDocument (the "outer document")
+ in turn has an iframe (the "inner document").
+
+ We request fullscreen in the outer document, and check that MozDOMFullscreen:Entered and
+ MozDOMFullscreen:NewOrigin are dispatched to chrome, targeted at the outer document.
+
+ Then we request fullscreen in the inner document, and check that MozDOMFullscreen:NewOrigin
+ is dispatched to chrome, targeted at the inner document.
+
+ Then we cancel fullscreen in the inner document, and check that MozDOMFullscreen:NewOrigin is
+ dispatched again to chrome, targeted at the outer document.
+-->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="start();">
+
+<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript"><![CDATA[
+
+function ok(condition, msg) {
+ window.opener.wrappedJSObject.ok(condition, msg);
+}
+
+function is(a, b, msg) {
+ window.opener.wrappedJSObject.is(a, b, msg);
+}
+
+var gBrowser = null;
+var gOuterDoc = null;
+var gInnerDoc = null;
+
+var gReceivedFullscreenEnteredEvent = false;
+var gReceivedNewOriginEvent = false;
+function firstEntry(event) {
+ if (event.type == "MozDOMFullscreen:Entered") {
+ window.removeEventListener("MozDOMFullscreen:Entered", firstEntry, false);
+ ok(!gReceivedFullscreenEnteredEvent, "MozDOMFullscreen:Entered shouldn't have been triggered twice");
+ is(event.target, gOuterDoc.body, "First MozDOMFullscreen:Entered should be targeted at outer body");
+ gReceivedFullscreenEnteredEvent = true;
+ } else if (event.type == "MozDOMFullscreen:NewOrigin") {
+ window.removeEventListener("MozDOMFullscreen:NewOrigin", firstEntry, false);
+ ok(!gReceivedNewOriginEvent, "MozDOMFullscreen:NewOrigin shouldn't have been triggered twice");
+ is(event.target, gOuterDoc, "First MozDOMFullscreen:NewOrigin should be targeted at outer doc");
+ gReceivedNewOriginEvent = true;
+ } else {
+ ok(false, "Unknown event received");
+ }
+ if (!gReceivedFullscreenEnteredEvent || !gReceivedNewOriginEvent) {
+ return;
+ }
+
+ ok(gOuterDoc.fullscreenElement != null, "Outer doc should be in fullscreen");
+ gInnerDoc = gOuterDoc.getElementById("innerFrame").contentDocument;
+ window.addEventListener("MozDOMFullscreen:NewOrigin", secondEntry, false);
+ gInnerDoc.defaultView.focus();
+ gInnerDoc.body.requestFullscreen();
+}
+
+function secondEntry(event) {
+ is(event.target, gInnerDoc, "Second MozDOMFullscreen:NewOrigin should be targeted at inner doc");
+ ok(gInnerDoc.fullscreenElement != null, "Inner doc should be in fullscreen");
+ window.removeEventListener("MozDOMFullscreen:NewOrigin", secondEntry, false);
+ window.addEventListener("MozDOMFullscreen:NewOrigin", thirdEntry, false);
+ gInnerDoc.exitFullscreen();
+}
+
+function thirdEntry(event) {
+ is(event.target, gOuterDoc, "Third MozDOMFullscreen:NewOrigin should be targeted at outer doc");
+ ok(gOuterDoc.fullscreenElement != null, "Outer doc return to fullscreen after cancel fullscreen in inner doc");
+ window.removeEventListener("MozDOMFullscreen:NewOrigin", thirdEntry, false);
+ window.removeEventListener("MozDOMFullscreen:Exited", earlyExit, false);
+ window.addEventListener("MozDOMFullscreen:Exited", lastExit, false);
+ gOuterDoc.exitFullscreen();
+}
+
+function earlyExit(event) {
+ ok(false, "MozDOMFullscreen:Exited should only be triggered after cancel all fullscreen");
+}
+
+function lastExit(event) {
+ is(event.target, gOuterDoc, "MozDOMFullscreen:Exited should be targeted at the last exited doc");
+ ok(gOuterDoc.fullscreenElement == null, "Fullscreen should have been fully exited");
+ window.opener.wrappedJSObject.done();
+}
+
+function start() {
+ SimpleTest.waitForFocus(
+ function() {
+ gBrowser = document.getElementById("browser");
+ gOuterDoc = gBrowser.contentDocument;
+ gBrowser.contentWindow.focus();
+ window.addEventListener("MozDOMFullscreen:Entered", firstEntry, false);
+ window.addEventListener("MozDOMFullscreen:NewOrigin", firstEntry, false);
+ gOuterDoc.body.requestFullscreen();
+ });
+}
+
+]]>
+</script>
+<browser type="content" id="browser" width="400" height="400" src="file_MozDomFullscreen.html"/>
+
+</window>
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 000000000..d7f0ff63c
--- /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 000000000..3060bc01e
--- /dev/null
+++ b/dom/tests/mochitest/chrome/chrome.ini
@@ -0,0 +1,90 @@
+[DEFAULT]
+skip-if = os == 'android'
+support-files =
+ 489127.html
+ DOMWindowCreated_chrome.xul
+ DOMWindowCreated_content.html
+ MozDomFullscreen_chrome.xul
+ child_focus_frame.html
+ file_DOM_element_instanceof.xul
+ file_MozDomFullscreen.html
+ file_bug799299.xul
+ file_bug800817.xul
+ file_bug830858.xul
+ file_bug1224790-1_modal.xul
+ file_bug1224790-1_nonmodal.xul
+ file_bug1224790-2_modal.xul
+ file_bug1224790-2_nonmodal.xul
+ file_subscript_bindings.js
+ focus_frameset.html
+ focus_window2.xul
+ fullscreen.xul
+ queryCaretRectUnix.html
+ queryCaretRectWin.html
+ selectAtPoint.html
+ sizemode_attribute.xul
+ window_activation.xul
+ window_callback_wrapping.xul
+ window_docshell_swap.xul
+ window_focus.xul
+ window_focus_docnav.xul
+ !/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.xul]
+[test_DOM_element_instanceof.xul]
+[test_activation.xul]
+tags = fullscreen
+[test_bug799299.xul]
+[test_bug800817.xul]
+[test_bug830396.xul]
+[test_bug830858.xul]
+[test_bug1224790-1.xul]
+tags = openwindow
+# synthesizeNativeOSXClick does not work on 10.6
+skip-if = os != 'mac' || os_version == '10.6'
+[test_bug1224790-2.xul]
+tags = openwindow
+# synthesizeNativeOSXClick does not work on 10.6
+skip-if = os != 'mac' || os_version == '10.6'
+[test_callback_wrapping.xul]
+[test_clonewrapper.xul]
+[test_cyclecollector.xul]
+[test_docshell_swap.xul]
+[test_focus.xul]
+skip-if = os == 'linux' && !debug # bug 1296622
+[test_focus_docnav.xul]
+[test_focus_switchbinding.xul]
+[test_focused_link_scroll.xul]
+[test_fullscreen.xul]
+tags = fullscreen
+# disabled on linux for timeouts--bug-867745
+skip-if = os == 'linux'
+[test_geolocation.xul]
+[test_indexedSetter.html]
+[test_moving_nodeList.xul]
+[test_moving_xhr.xul]
+[test_MozDomFullscreen_event.xul]
+tags = fullscreen
+# disabled on OS X for intermittent failures--bug-798848
+skip-if = toolkit == 'cocoa'
+[test_nodesFromRect.html]
+[test_parsingMode.html]
+[test_popup_blocker_chrome.xul]
+[test_queryCaretRect.html]
+[test_resize_move_windows.xul]
+# disabled on linux for timeouts--bug-834716
+skip-if = os == 'linux'
+[test_sandbox_bindings.xul]
+[test_sandbox_eventhandler.xul]
+[test_sandbox_image.xul]
+[test_sandbox_postMessage.html]
+[test_selectAtPoint.html]
+[test_sizemode_attribute.xul]
+tags = fullscreen
+skip-if = os != 'win'
+[test_subscript_bindings.xul]
+[test_xray_event_constructor.xul]
+[test_clipboard_events_chrome.html]
diff --git a/dom/tests/mochitest/chrome/file_DOM_element_instanceof.xul b/dom/tests/mochitest/chrome/file_DOM_element_instanceof.xul
new file mode 100644
index 000000000..e4cfd8d30
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_DOM_element_instanceof.xul
@@ -0,0 +1,30 @@
+<?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 = opener.wrappedJSObject.SimpleTest;
+ var ok = opener.wrappedJSObject.ok;
+
+ var doc = frames[0].document;
+ ok(doc.createElement("body") instanceof HTMLBodyElement,
+ "Should be instance of HTMLBodyElement");
+ ok(doc.createElement("div") instanceof HTMLDivElement,
+ "Should be instance of HTMLDivElement");
+ ok(doc.createElement("frameset") instanceof HTMLFrameSetElement,
+ "Should be instance of HTMLFrameSetElement");
+ ok(doc.createElement("h1") instanceof HTMLHeadingElement,
+ "Should be instance of HTMLHeadingElement");
+ ok(doc.createElement("label") instanceof HTMLLabelElement,
+ "Should be instance of HTMLLabelElement");
+
+ window.close();
+ opener.wrappedJSObject.SimpleTest.finish();
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_MozDomFullscreen.html b/dom/tests/mochitest/chrome/file_MozDomFullscreen.html
new file mode 100644
index 000000000..f95489270
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_MozDomFullscreen.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body style="background-color: blue;">
+<p>Outer doc</p>
+<iframe id="innerFrame" src="http://mochi.test:8888/"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/chrome/file_bug1224790-1_modal.xul b/dom/tests/mochitest/chrome/file_bug1224790-1_modal.xul
new file mode 100644
index 000000000..7a2ad495f
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-1_modal.xul
@@ -0,0 +1,33 @@
+<?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
+-->
+<dialog title="Mozilla Bug 1224790"
+ buttons="accept"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" 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.xul', '', 'dialog=no');
+ }
+
+ function nonModalClosed() {
+ window.close();
+ opener.wrappedJSObject.modalClosed();
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+</dialog>
diff --git a/dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xul b/dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xul
new file mode 100644
index 000000000..e09efc9c0
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-1_nonmodal.xul
@@ -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 type="application/javascript" 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.xul b/dom/tests/mochitest/chrome/file_bug1224790-2_modal.xul
new file mode 100644
index 000000000..34f49e3c4
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-2_modal.xul
@@ -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=1224790
+-->
+<dialog title="Mozilla Bug 1224790"
+ buttons="accept"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" 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.xul', '', 'dialog=no');
+ }
+
+ function nonModalOpened() {
+ window.close();
+ nonModal.wrappedJSObject.modalClosed(opener);
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+</dialog>
diff --git a/dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xul b/dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xul
new file mode 100644
index 000000000..0116dfeb2
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug1224790-2_nonmodal.xul
@@ -0,0 +1,46 @@
+<?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 type="application/javascript" 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.
+ const Ci = Components.interfaces;
+ const Cu = Components.utils;
+ var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
+ var windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils);
+
+ Services.obs.notifyObservers(null, "child-cc-request", null);
+ 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_bug799299.xul b/dom/tests/mochitest/chrome/file_bug799299.xul
new file mode 100644
index 000000000..2bbb0a23a
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug799299.xul
@@ -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=799299
+-->
+<window title="Mozilla Bug 799299"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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=799299"
+ target="_blank">Mozilla Bug 799299</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 799299 **/
+
+ function sendClick(win) {
+ var wu = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils);
+ 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");
+ b1.contentWindow.focus();
+ opener.wrappedJSObject.is(document.activeElement, b1,
+ "Focused first iframe");
+
+ var didCallDummy = false;
+ b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
+ sendClick(b2.contentWindow);
+ opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
+ opener.wrappedJSObject.is(document.activeElement, b2,
+ "Focus shifted to second iframe");
+
+ b1.contentWindow.focus();
+ opener.wrappedJSObject.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);
+ opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
+ opener.wrappedJSObject.is(document.activeElement, b2,
+ "focus should move to the second iframe");
+
+ window.close();
+ opener.wrappedJSObject.SimpleTest.finish();
+ }
+
+ SimpleTest.waitForFocus(runTests);
+ ]]>
+ </script>
+ <hbox flex="1">
+ <browser id="b1" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
+ <browser id="b2" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
+ </hbox>
+</window>
diff --git a/dom/tests/mochitest/chrome/file_bug800817.xul b/dom/tests/mochitest/chrome/file_bug800817.xul
new file mode 100644
index 000000000..87f900074
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug800817.xul
@@ -0,0 +1,80 @@
+<?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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils);
+ 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 = opener.wrappedJSObject.testMozBrowser;
+ if (testMozBrowser) {
+ b1.setAttribute("mozbrowser", "true");
+ b2.setAttribute("mozbrowser", "true");
+ }
+
+ if (testMozBrowser)
+ opener.wrappedJSObject.info("Testing with mozbrowser=true");
+ else
+ opener.wrappedJSObject.info("Testing without mozbrowser");
+
+ b1.contentWindow.focus();
+ opener.wrappedJSObject.is(document.activeElement, b1,
+ "Focused first iframe");
+
+ var didCallDummy = false;
+ b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
+ sendClick(b2.contentWindow);
+ opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
+ opener.wrappedJSObject.is(document.activeElement, b2,
+ "Focus shifted to second iframe");
+
+ b1.contentWindow.focus();
+ opener.wrappedJSObject.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);
+ opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
+ opener.wrappedJSObject.is(document.activeElement, b1,
+ "Did not move focus to the second iframe");
+
+ window.close();
+ opener.wrappedJSObject.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.xul b/dom/tests/mochitest/chrome/file_bug830858.xul
new file mode 100644
index 000000000..ba2a7c1b8
--- /dev/null
+++ b/dom/tests/mochitest/chrome/file_bug830858.xul
@@ -0,0 +1,67 @@
+<?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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils);
+
+ 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"));
+ opener.wrappedJSObject.is(docListenerCalled, 1, "Normal dispatch to Document");
+ opener.wrappedJSObject.is(winListenerCalled, 1, "Normal dispatch to Document");
+ opener.wrappedJSObject.is(iframeListenerCalled, 1, "Normal dispatch to Document");
+
+ win.dispatchEvent(new Event("foo"));
+ opener.wrappedJSObject.is(docListenerCalled, 1, "Normal dispatch to Window");
+ opener.wrappedJSObject.is(winListenerCalled, 2, "Normal dispatch to Window");
+ opener.wrappedJSObject.is(iframeListenerCalled, 2, "Normal dispatch to Window");
+
+ wu.dispatchEventToChromeOnly(doc, new Event("foo"));
+ opener.wrappedJSObject.is(docListenerCalled, 1, "Chrome-only dispatch to Document");
+ opener.wrappedJSObject.is(winListenerCalled, 2, "Chrome-only dispatch to Document");
+ opener.wrappedJSObject.is(iframeListenerCalled, 3, "Chrome-only dispatch to Document");
+
+ wu.dispatchEventToChromeOnly(win, new Event("foo"));
+ opener.wrappedJSObject.is(docListenerCalled, 1, "Chrome-only dispatch to Window");
+ opener.wrappedJSObject.is(winListenerCalled, 2, "Chrome-only dispatch to Window");
+ opener.wrappedJSObject.is(iframeListenerCalled, 4, "Chrome-only dispatch to Window");
+
+ window.close();
+ opener.wrappedJSObject.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_subscript_bindings.js b/dom/tests/mochitest/chrome/file_subscript_bindings.js
new file mode 100644
index 000000000..cfc9128d3
--- /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_frameset.html b/dom/tests/mochitest/chrome/focus_frameset.html
new file mode 100644
index 000000000..32cfa5cdb
--- /dev/null
+++ b/dom/tests/mochitest/chrome/focus_frameset.html
@@ -0,0 +1,26 @@
+<html id="outer">
+
+<script type="application/javascript"
+ 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.xul b/dom/tests/mochitest/chrome/focus_window2.xul
new file mode 100644
index 000000000..1e67343d9
--- /dev/null
+++ b/dom/tests/mochitest/chrome/focus_window2.xul
@@ -0,0 +1,27 @@
+<?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 type="application/javascript"
+ 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"/>
+<textbox id="other-textbox" value="test"/>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/fullscreen.xul b/dom/tests/mochitest/chrome/fullscreen.xul
new file mode 100644
index 000000000..faaafec94
--- /dev/null
+++ b/dom/tests/mochitest/chrome/fullscreen.xul
@@ -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"?>
+<!--
+ Test for fullscreen sizemode in chrome
+ -->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ sizemode="fullscreen">
+
+<script>
+
+window.addEventListener("fullscreen", onFullScreen, true);
+
+function onFullScreen(event)
+{
+ window.opener.wrappedJSObject.done(window.fullScreen);
+}
+
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+
+<button id="find-button" label="Find"/>
+<button id="cancel-button" label="Cancel"/>
+
+</body>
+</window>
diff --git a/dom/tests/mochitest/chrome/queryCaretRectUnix.html b/dom/tests/mochitest/chrome/queryCaretRectUnix.html
new file mode 100644
index 000000000..fae5bb7ec
--- /dev/null
+++ b/dom/tests/mochitest/chrome/queryCaretRectUnix.html
@@ -0,0 +1,214 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>nsIDOMWindowUtils::sendQueryContentEvent w/QUERY_CARET_RECT test</title>
+<script type="text/javascript" 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;version=1.8">
+ var SimpleTest = window.opener.SimpleTest;
+ var Ci = Components.interfaces;
+
+ 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) {
+ if (aElement instanceof Ci.nsIDOMNSEditableElement) {
+ return aElement.QueryInterface(Ci.nsIDOMNSEditableElement)
+ .editor.selection;
+ }
+ return null;
+ }
+
+ 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.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+
+ 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 000000000..cd5a8ec64
--- /dev/null
+++ b/dom/tests/mochitest/chrome/queryCaretRectWin.html
@@ -0,0 +1,223 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>nsIDOMWindowUtils::sendQueryContentEvent w/QUERY_CARET_RECT test</title>
+<script type="text/javascript" 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;version=1.8">
+ var SimpleTest = window.opener.SimpleTest;
+ var Ci = Components.interfaces;
+
+ 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) {
+ if (aElement instanceof Ci.nsIDOMNSEditableElement) {
+ return aElement.QueryInterface(Ci.nsIDOMNSEditableElement)
+ .editor.selection;
+ }
+ return null;
+ }
+
+ 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.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+
+ 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.html b/dom/tests/mochitest/chrome/selectAtPoint.html
new file mode 100644
index 000000000..8c625e6f7
--- /dev/null
+++ b/dom/tests/mochitest/chrome/selectAtPoint.html
@@ -0,0 +1,281 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>nsIDOMWindowUtils::selectAtPoint test</title>
+<script type="text/javascript" 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;version=1.8">
+ var SimpleTest = window.opener.SimpleTest;
+ var Ci = Components.interfaces;
+
+ 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();
+ return { width: rect.right - rect.left,
+ height: rect.bottom - rect.top };
+ }
+
+ 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 secceeded?");
+ }
+
+ function setEnd(aDWU, aX, aY, aSelectType)
+ {
+ // Select text
+ let result = aDWU.selectAtPoint(aX, aY, aSelectType);
+ ok(result == true, "selectAtPoint secceeded?");
+ }
+
+ 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 secceeded?");
+ }
+
+ 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.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+
+ let os = Components.classes["@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();
+
+ // 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.");
+
+ // Centered on the second character in the sentence div
+ targetPoint = { xPos: rect.left + (charDims.width + (charDims.width / 2)),
+ yPos: rect.top + (charDims.height / 2) };
+ setSingle(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
+ checkSelection(document, "SELECT_CHARACTER", "te");
+ setSingle(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CLUSTER);
+ checkSelection(document, "SELECT_CLUSTER", "te");
+
+ // Separate character blocks in a word 't(te)s(ts)election1'
+ targetPoint = { xPos: rect.left + (charDims.width + (charDims.width / 2)),
+ yPos: rect.top + (charDims.height / 2) };
+ setStart(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
+ targetPoint = { xPos: rect.left + ((charDims.width * 4) + (charDims.width / 2)),
+ yPos: rect.top + (charDims.height / 2) };
+ setEnd(dwu, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
+ if (isLinux || isMac) {
+ // XXX I think this is a bug, the right hand selection is 4.5 characters over with a
+ // monspaced font. what we want: t(te)s(ts)election1 what we get: t(te)st(se)lection1
+ checkSelection(document, "split selection", "tese");
+ } else if (isWindows) {
+ checkSelection(document, "split selection", "tets");
+ }
+
+ // 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();
+
+ // 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
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+
+ frame.contentWindow.scrollTo(0, 0);
+
+ rect = frame.getBoundingClientRect();
+
+ 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, false);
+ painted = true;
+ testReady();
+ }
+
+ window.addEventListener("MozAfterPaint", onPaint, false);
+</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="data:text/html,<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>"></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.xul b/dom/tests/mochitest/chrome/sizemode_attribute.xul
new file mode 100644
index 000000000..bb65c04bb
--- /dev/null
+++ b/dom/tests/mochitest/chrome/sizemode_attribute.xul
@@ -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;version=1.8">
+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.opener.wrappedJSObject.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.opener.wrappedJSObject.is;
+
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+
+</body>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_DOMWindowCreated.xul b/dom/tests/mochitest/chrome/test_DOMWindowCreated.xul
new file mode 100644
index 000000000..2b74cde11
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_DOMWindowCreated.xul
@@ -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.open(root + "DOMWindowCreated_chrome.xul", "_blank", "chrome,width=600,height=550");
+</script>
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_DOM_element_instanceof.xul b/dom/tests/mochitest/chrome/test_DOM_element_instanceof.xul
new file mode 100644
index 000000000..220220420
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_DOM_element_instanceof.xul
@@ -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 type="application/javascript" 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.open("file_DOM_element_instanceof.xul", "_blank", "chrome,width=600,height=550");
+ }
+
+ addLoadEvent(runTests);
+
+ SimpleTest.waitForExplicitFinish();
+
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul b/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul
new file mode 100644
index 000000000..3ece38553
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul
@@ -0,0 +1,56 @@
+<?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 that "MozShowFullScreenWarning" is dispatched to chrome on restricted keypress.
+ -->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="400" height="400">
+
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+
+// Ensure the full-screen api is enabled, and will be disabled on test exit.
+var gPrevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
+var gPrevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
+var newwindow;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+
+function make_uri(url) {
+ var ios = Cc["@mozilla.org/network/io-service;1"].
+ getService(Ci.nsIIOService);
+ return ios.newURI(url, null, null);
+}
+
+// Ensure "fullscreen" permissions are not present on the test URI.
+var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
+var uri = make_uri("http://mochi.test:8888");
+var ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+ .getService(Ci.nsIScriptSecurityManager);
+var principal = ssm.createCodebasePrincipal(uri, {});
+pm.removeFromPrincipal(principal, "fullscreen");
+
+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']
+]}, setup);
+
+function setup() {
+ newwindow = window.open("MozDomFullscreen_chrome.xul", "_blank","chrome,resizable=yes,width=400,height=400");
+}
+
+function done()
+{
+ 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_activation.xul b/dom/tests/mochitest/chrome/test_activation.xul
new file mode 100644
index 000000000..ff1809036
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_activation.xul
@@ -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.open("window_activation.xul", "_blank","chrome,width=300,height=200");
+
+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.xul b/dom/tests/mochitest/chrome/test_bug1224790-1.xul
new file mode 100644
index 000000000..6c14d7c08
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug1224790-1.xul
@@ -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"?>
+<!--
+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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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.xul', '', 'modal');
+ }
+
+ 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.
+ // Need to emulate native mouse event.
+ synthesizeNativeOSXClick(button.boxObject.screenX + button.boxObject.width / 2,
+ button.boxObject.screenY + button.boxObject.height / 2);
+ }
+ 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.xul b/dom/tests/mochitest/chrome/test_bug1224790-2.xul
new file mode 100644
index 000000000..5ce7f1054
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug1224790-2.xul
@@ -0,0 +1,72 @@
+<?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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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.xul', '', 'modal');
+ }
+
+ 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.
+ // Need to emulate native mouse event.
+ synthesizeNativeOSXClick(button.boxObject.screenX + button.boxObject.width / 2,
+ button.boxObject.screenY + button.boxObject.height / 2);
+ }
+ 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_bug799299.xul b/dom/tests/mochitest/chrome/test_bug799299.xul
new file mode 100644
index 000000000..9819f95a1
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug799299.xul
@@ -0,0 +1,31 @@
+<?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=799299
+-->
+<window title="Mozilla Bug 799299" onload="runTests()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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=799299"
+ target="_blank">Mozilla Bug 799299</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 799299 **/
+
+ function runTests() {
+ window.open("file_bug799299.xul", "_blank", "chrome,width=600,height=550");
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_bug800817.xul b/dom/tests/mochitest/chrome/test_bug800817.xul
new file mode 100644
index 000000000..7a0aaeb6f
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug800817.xul
@@ -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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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.open("file_bug800817.xul", "_blank", "chrome,width=600,height=550");
+ }
+
+ function finishedTests() {
+ if (!testMozBrowser) {
+ testMozBrowser = true;
+ // Run a second round of tests for mozbrowser iframes.
+ window.open("file_bug800817.xul", "_blank", "chrome,width=600,height=550");
+ } else {
+ SimpleTest.finish();
+ }
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_bug830396.xul b/dom/tests/mochitest/chrome/test_bug830396.xul
new file mode 100644
index 000000000..e5f32930f
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug830396.xul
@@ -0,0 +1,39 @@
+<?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=830396
+-->
+<window title="Mozilla Bug 830396"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
+<script class="testbody" type="application/javascript">
+<![CDATA[
+
+function runTests()
+{
+ var doc = frames[0].document;
+ var cs = doc.defaultView.getComputedStyle(doc.body);
+ var nsIDOMCSSValueList = Components.interfaces.nsIDOMCSSValueList;
+ ok(cs.getPropertyCSSValue("cursor") instanceof nsIDOMCSSValueList,
+ "CSSValueList should be a nsIDOMCSSValueList");
+ SimpleTest.finish();
+}
+]]>
+</script>
+<body onload="runTests();" xmlns="http://www.w3.org/1999/xhtml">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=830396">Mozilla Bug 830396</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+<iframe type="content"></iframe>
+</body>
+
+
+</window>
diff --git a/dom/tests/mochitest/chrome/test_bug830858.xul b/dom/tests/mochitest/chrome/test_bug830858.xul
new file mode 100644
index 000000000..61ab13fd0
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_bug830858.xul
@@ -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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 830858 **/
+
+ function runTests() {
+ window.open("file_bug830858.xul", "_blank", "chrome,width=600,height=550");
+ }
+
+ 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.xul b/dom/tests/mochitest/chrome/test_callback_wrapping.xul
new file mode 100644
index 000000000..4546c65d5
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_callback_wrapping.xul
@@ -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 type="application/javascript" 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.xul");
+ </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 000000000..509cd3d5d
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_clipboard_events_chrome.html
@@ -0,0 +1,63 @@
+<html>
+<body onload="runTest()">
+
+<script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript"
+ 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.open("data:text/html,<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>",
+ "_blank", "chrome,width=200,height=200");
+ });
+}
+
+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.xul b/dom/tests/mochitest/chrome/test_clonewrapper.xul
new file mode 100644
index 000000000..ceef40fdc
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_clonewrapper.xul
@@ -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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ // Setup.
+ const Cu = Components.utils;
+ 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],
+ true, "Should be able to clone cross-origin with document.domain")
+ }, 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(Cu.waiveXrays(cloneResult).toSource(), win2.wrappedJSObject.testObject.toSource(),
+ "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.xul b/dom/tests/mochitest/chrome/test_cyclecollector.xul
new file mode 100644
index 000000000..28bb5e7a9
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_cyclecollector.xul
@@ -0,0 +1,55 @@
+<?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 type="application/javascript" 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 **/
+ let Ci = Components.interfaces;
+ var obs = Components.classes["@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.results.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", false);
+
+ SpecialPowers.DOMWindowUtils.cycleCollect();
+
+ ok(didCall, "Observer should have been called!");
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_docshell_swap.xul b/dom/tests/mochitest/chrome/test_docshell_swap.xul
new file mode 100644
index 000000000..b80e402cd
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_docshell_swap.xul
@@ -0,0 +1,74 @@
+<?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 type="application/javascript" 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.openDialog("window_docshell_swap.xul", "_blank","chrome,width=300,height=200");
+ let win2 = window.openDialog("window_docshell_swap.xul", "_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 flo1 = browser1.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
+ let flo2 = browser2.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
+
+ 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 = flo1.frameLoader.messageManager;
+ let mm2 = flo2.frameLoader.messageManager;
+
+ // Swap docshells. Everything should be identical to before, since there was nothing to
+ // distinguish these docshells.
+ flo1.swapFrameLoaders(flo2);
+
+ // mm1 shouldn't change here, but we update it in case it does due to a bug.
+ mm1 = flo1.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_focus.xul b/dom/tests/mochitest/chrome/test_focus.xul
new file mode 100644
index 000000000..14fecb9c4
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focus.xul
@@ -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 type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+<script>
+if (navigator.platform.startsWith("Win")) {
+ SimpleTest.expectAssertions(0, 1);
+}
+
+SimpleTest.waitForExplicitFinish();
+function runTest()
+{
+ window.open("window_focus.xul", "_blank", "chrome,width=600,height=550");
+}
+</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.xul b/dom/tests/mochitest/chrome/test_focus_docnav.xul
new file mode 100644
index 000000000..48ce66fac
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focus_docnav.xul
@@ -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 onload="runTest();"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+function runTest()
+{
+ window.open("window_focus_docnav.xul", "_blank", "chrome,width=600,height=550");
+}
+</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_switchbinding.xul b/dom/tests/mochitest/chrome/test_focus_switchbinding.xul
new file mode 100644
index 000000000..2f3e0c944
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focus_switchbinding.xul
@@ -0,0 +1,57 @@
+<?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 Switch Binding Test"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+
+function switchBinding()
+{
+ $("box").style.MozBinding = "url(#second)";
+}
+</script>
+
+<xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <xbl:binding id="first">
+ <xbl:content>
+ <xul:button label="First"/>
+ </xbl:content>
+ <xbl:implementation>
+ <xbl:constructor>
+ document.getAnonymousNodes(this)[0].focus();
+ setTimeout(switchBinding, 0);
+ </xbl:constructor>
+ </xbl:implementation>
+ </xbl:binding>
+ <xbl:binding id="second">
+ <xbl:content>
+ <xul:button label="Second"/>
+ </xbl:content>
+ <xbl:implementation>
+ <xbl:constructor>
+ $("after").focus();
+ </xbl:constructor>
+ </xbl:implementation>
+ </xbl:binding>
+</xbl:bindings>
+
+<box id="box" style="-moz-binding: url(#first)"/>
+<button id="after" label="After" onfocus="is(document.activeElement, $('after'), 'focus set'); SimpleTest.finish()"/>
+
+<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.xul b/dom/tests/mochitest/chrome/test_focused_link_scroll.xul
new file mode 100644
index 000000000..1621eef83
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_focused_link_scroll.xul
@@ -0,0 +1,48 @@
+<?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 type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript"
+ 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_fullscreen.xul b/dom/tests/mochitest/chrome/test_fullscreen.xul
new file mode 100644
index 000000000..fcc577f6d
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_fullscreen.xul
@@ -0,0 +1,37 @@
+<?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"
+ sizemode="fullscreen">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+
+newwindow = window.open("fullscreen.xul", "_blank","chrome,resizable=yes");
+
+function done()
+{
+ // because we are cancelling the fullscreen event, it
+ // takes a bit for the fullScreen property to be set
+ setTimeout("complete()", 0);
+}
+
+function complete()
+{
+ ok(newwindow.fullScreen, "window.fullScreen is true.");
+ 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_geolocation.xul b/dom/tests/mochitest/chrome/test_geolocation.xul
new file mode 100644
index 000000000..ba01149e5
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_geolocation.xul
@@ -0,0 +1,35 @@
+<?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 type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script>
+SimpleTest.waitForExplicitFinish();
+
+var Ci = Components.interfaces;
+var Cc = Components.classes;
+
+var geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
+geolocation.getCurrentPosition(done, error);
+
+function error(error)
+{
+ ok(0, "error occured trying to get geolocation from chrome");
+ SimpleTest.finish();
+}
+function done(position)
+{
+ ok(position, "geolocation was found from chrome");
+ 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_indexedSetter.html b/dom/tests/mochitest/chrome/test_indexedSetter.html
new file mode 100644
index 000000000..2a90f4548
--- /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 type="text/javascript" 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(Components.utils.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_moving_nodeList.xul b/dom/tests/mochitest/chrome/test_moving_nodeList.xul
new file mode 100644
index 000000000..9762cedda
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_moving_nodeList.xul
@@ -0,0 +1,45 @@
+<?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 type="application/javascript"
+ 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.xul b/dom/tests/mochitest/chrome/test_moving_xhr.xul
new file mode 100644
index 000000000..63946342b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_moving_xhr.xul
@@ -0,0 +1,41 @@
+<?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 type="application/javascript"
+ 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_nodesFromRect.html b/dom/tests/mochitest/chrome/test_nodesFromRect.html
new file mode 100644
index 000000000..50910d64a
--- /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 type="text/javascript" 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 000000000..011bded1d
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_parsingMode.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>CSSStyleSheet parsingMode test - bug 1230491</title>
+ <script type="text/javascript" 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 run() {
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
+
+ const sss = Cc["@mozilla.org/content/style-sheet-service;1"]
+ .getService(Ci.nsIStyleSheetService);
+ const domutils = Cc["@mozilla.org/inspector/dom-utils;1"]
+ .getService(Ci.inIDOMUtils);
+ const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+
+ const userUrl = encodeURI("data:text/css,body { color: seagreen; }");
+ 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 domutils.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");
+ 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;
+ domutils.parseStyleSheet(sheet, "body { color: chartreuse; }");
+ 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.xul b/dom/tests/mochitest/chrome/test_popup_blocker_chrome.xul
new file mode 100644
index 000000000..d2e421651
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_popup_blocker_chrome.xul
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="/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 type="application/javascript" 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 **/
+
+ SimpleTest.waitForExplicitFinish();
+
+ // We have to enable dom.disable_open_during_load which is disabled
+ // by the test harness.
+ let prefs = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+ var gLastDomLoadValue = prefs.getBoolPref("dom.disable_open_during_load");
+ prefs.setBoolPref("dom.disable_open_during_load", true);
+
+ let w = window.open("data:text/html,foobar", "", "width=200,height=200");
+ ok(w, "The window object shouldn't be null");
+
+ SimpleTest.waitForFocus(function() {
+ w.close();
+ ok(true, "The popup appeared");
+
+ SimpleTest.waitForFocus(function() {
+ let w = window.open("data:text/html,foobar", "", "width=200,height=200");
+ ok(w, "The window object shouldn't be null");
+
+ SimpleTest.waitForFocus(function() {
+ w.close();
+
+ ok(true, "The popup appeared");
+ prefs.setBoolPref("dom.disable_open_during_load", gLastDomLoadValue);
+ SimpleTest.finish();
+ }, w, false);
+ });
+ }, w, false);
+ ]]>
+ </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 000000000..ef7165077
--- /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 type="text/javascript" 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 Components.classes);
+ 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.xul b/dom/tests/mochitest/chrome/test_resize_move_windows.xul
new file mode 100644
index 000000000..b5102a79a
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_resize_move_windows.xul
@@ -0,0 +1,282 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="/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 type="application/javascript" 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.innerWidth;
+ previousHeight = window.top.innerHeight;
+ }
+
+ function restoreValues()
+ {
+ window.top.screenX = previousX;
+ window.top.screenY = previousY;
+ window.top.innerWidth = previousWidth;
+ window.top.innerHeight = 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.indexOf('Linux') != -1) {
+ return aWindow.screenX != prevX || aWindow.screenY != prevY;
+ }
+ return aWindow.screenX != prevX && aWindow.screenY != prevY;
+ }
+
+ function posChangeConditionIgnoreLinux() {
+ if (posChangeCondition()) {
+ return true;
+ }
+
+ if (navigator.platform.indexOf('Linux') != -1) {
+ return true;
+ }
+ }
+
+ function posChangeTest() {
+ // With GTK, sometimes, only one dimension changes.
+ if (navigator.platform.indexOf('Linux') != -1) {
+ // 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.outerWidth = oWidth;
+ aWindow.outerHeight = oHeight;
+ }
+
+ /**
+ * Size checks.
+ */
+ prevWidth = aWindow.innerWidth;
+ prevHeight = aWindow.innerHeight;
+
+ aWindow.innerWidth = getNewWidth(aWindow);
+ aWindow.innerHeight = getNewHeight(aWindow);
+
+ hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
+ 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 = getNewWidth(aWindow);
+ prevHeight = aWindow.innerHeight = getNewHeight(aWindow);
+ aWindow.sizeToContent();
+
+ hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
+ /**
+ * Position checks.
+ */
+ prevX = aWindow.screenX;
+ prevY = aWindow.screenY;
+
+ aWindow.screenX = getNewX(aWindow);
+ aWindow.screenY = getNewY(aWindow);
+
+ hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
+ aWindow.moveTo(getNewX(aWindow), getNewY(aWindow));
+
+ hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
+ 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.outerWidth = oWidth * 2;
+ aWindow.outerHeight = oHeight * 2;
+
+ hitEventLoop(outerChangeCondition, outerChangeTest, hits, aNext);
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.waitForFocus(function() {
+ if (screen.width <= 200 || screen.height <= 200) {
+ todo(false, "The screen is too small to run this test.");
+ SimpleTest.finish();
+ }
+
+ backValues();
+
+ // We are in a chrome context, we can change the size and position.
+ checkChangeIsEnabled(window.top, 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("data:text/html,<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');" +
+ " checkChangeIsEnabled(window, next);" +
+ "} <\/script>", '',
+ 'width=170,height=170,screenX=25,screenY=25');
+
+ SimpleTest.waitForFocus(function() {
+ // This test relies on passing cross-origin windows to a chrome function,
+ // which is generally forbidden if we don't twiddle the knob below.
+ Components.utils.forcePermissiveCOWs();
+ w.wrappedJSObject.ok = SimpleTest.ok;
+ w.wrappedJSObject.checkChangeIsEnabled = window.checkChangeIsEnabled;
+ w.wrappedJSObject.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 a chrome context, the size and position can change.
+ w = window.open("data:text/html,<script>" +
+ "function check(next) {" +
+ " checkChangeIsEnabled(window, next);" +
+ "} <\/script>", '', '');
+
+ SimpleTest.waitForFocus(function() {
+ w.wrappedJSObject.checkChangeIsEnabled = window.checkChangeIsEnabled;
+ w.wrappedJSObject.check(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);
+ });
+ });
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/chrome/test_sandbox_bindings.xul b/dom/tests/mochitest/chrome/test_sandbox_bindings.xul
new file mode 100644
index 000000000..eaf940010
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sandbox_bindings.xul
@@ -0,0 +1,318 @@
+<?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 type="application/javascript" 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 **/
+ const Cu = Components.utils;
+ function isXrayWrapper(x) {
+ return Components.utils.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 = Components.utils.Sandbox(win, { sandboxPrototype: win });
+
+ is(sandbox._content, undefined, "_content does nothing over Xray");
+
+ try {
+ var css = Components.utils.evalInSandbox("CSSStyleDeclaration", sandbox);
+ is(String(css.prototype), "[object CSSStyleDeclarationPrototype]",
+ "'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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.evalInSandbox("XMLHttpRequest", sandbox);
+ xhr.prototype = "notok";
+ } finally {
+ isnot(xhr.prototype, "notok", "'XMLHttpRequest.prototype' should be readonly");
+ }
+ var constructorWritable = false;
+ try {
+ var xhr = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 {
+ Components.utils.evalInSandbox("XMLHttpRequest.prototype.a = 'expando a'", sandbox);
+ Components.utils.evalInSandbox("XMLHttpRequest.prototype.b = 'expando b'", sandbox);
+ Components.utils.evalInSandbox("XMLHttpRequest.prototype", sandbox).b = 'xrayexpando';
+ var xhr = Components.utils.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 {
+ Components.utils.evalInSandbox("document.defaultView.XMLHttpRequest = function() {};", sandbox);
+ var win = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.Sandbox(win.document.nodePrincipal,
+ { sandboxPrototype: win });
+ try {
+ var ws = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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 = Components.utils.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.xul b/dom/tests/mochitest/chrome/test_sandbox_eventhandler.xul
new file mode 100644
index 000000000..536a94517
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sandbox_eventhandler.xul
@@ -0,0 +1,38 @@
+<?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 type="application/javascript" 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 cu = Components.utils;
+ 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.xul b/dom/tests/mochitest/chrome/test_sandbox_image.xul
new file mode 100644
index 000000000..15818b903
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sandbox_image.xul
@@ -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 type="application/javascript" 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 = Components.utils.Sandbox(win, { sandboxPrototype: win });
+ var result = Components.utils.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 000000000..46164a181
--- /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 type="text/javascript" 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 = Components.utils.Sandbox("http://mochi.test:8888/", { wantXrays: true });
+ var win = window.frames["sameDomain"];
+ sandbox.win = win;
+ sandbox.is = is;
+ sandbox.done = SimpleTest.finish;
+
+ result = Components.utils.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 000000000..c96c6607b
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_selectAtPoint.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIDOMWindowUtils::selectAtPoint test</title>
+ <script type="text/javascript" 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.xul b/dom/tests/mochitest/chrome/test_sizemode_attribute.xul
new file mode 100644
index 000000000..d0066ea1c
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_sizemode_attribute.xul
@@ -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.open("sizemode_attribute.xul", "_blank","chrome,resizable=yes");
+
+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.xul b/dom/tests/mochitest/chrome/test_subscript_bindings.xul
new file mode 100644
index 000000000..132d3b4d6
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_subscript_bindings.xul
@@ -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 type="application/javascript" 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 = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.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_xray_event_constructor.xul b/dom/tests/mochitest/chrome/test_xray_event_constructor.xul
new file mode 100644
index 000000000..9e18374ee
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_xray_event_constructor.xul
@@ -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 type="application/javascript" 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(Components.utils.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.xul b/dom/tests/mochitest/chrome/window_activation.xul
new file mode 100644
index 000000000..eb2d44ed4
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_activation.xul
@@ -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.opener.wrappedJSObject.ok;
+var complete = window.opener.wrappedJSObject.complete;
+var openerDoc = window.opener.wrappedJSObject.document;
+var SimpleTest = window.opener.wrappedJSObject.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.opener.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.xul b/dom/tests/mochitest/chrome/window_callback_wrapping.xul
new file mode 100644
index 000000000..6bb817657
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_callback_wrapping.xul
@@ -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.xul b/dom/tests/mochitest/chrome/window_docshell_swap.xul
new file mode 100644
index 000000000..3b849b64c
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_docshell_swap.xul
@@ -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.xul b/dom/tests/mochitest/chrome/window_focus.xul
new file mode 100644
index 000000000..4bf210311
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_focus.xul
@@ -0,0 +1,1729 @@
+<?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 type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<body xmlns="http://www.w3.org/1999/xhtml"/>
+
+ <script type="application/javascript"><![CDATA[
+
+var fm = Components.classes["@mozilla.org/focus-manager;1"].
+ getService(Components.interfaces.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.opener.wrappedJSObject.SimpleTest.is(l,r,n); }
+function ok(v, n) { window.opener.wrappedJSObject.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 (event.target instanceof Element && event.target.localName == "iframe")
+ ok(false, "iframe " + event.type + "occured");
+
+ var id;
+ if (gOldExpectedWindow && event.type == "blur") {
+ if (event.target instanceof Window)
+ id = "frame-" + gOldExpectedWindow.document.documentElement.id + "-window";
+ else if (event.target instanceof Document)
+ id = "frame-" + gOldExpectedWindow.document.documentElement.id + "-document";
+ else
+ id = event.originalTarget.id;
+ }
+ else if (gNewExpectedWindow && event.type == "focus") {
+ if (event.target instanceof Window)
+ id = "frame-" + gNewExpectedWindow.document.documentElement.id + "-window";
+ else if (event.target instanceof Document)
+ 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 (event.target instanceof Window)
+ id = (event.target == window) ? "outer-window" : "child-window";
+ else if (event.target instanceof Document)
+ 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.ownerDocument.defaultView :
+ 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.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
+ getInterface(Components.interfaces.nsIWebNavigation).
+ QueryInterface(Components.interfaces.nsIDocShellTreeItem).rootTreeItem.
+ QueryInterface(Components.interfaces.nsIInterfaceRequestor).
+ getInterface(Components.interfaces.nsIDOMWindow);
+}
+
+function mouseWillTriggerFocus(element)
+{
+ if (!element) {
+ return false;
+ }
+
+ if (navigator.platform.indexOf("Mac") != 0) {
+ 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 == "listbox") {
+ return true;
+ }
+
+ return false;
+}
+
+function mouseOnElement(element, expectedElement, focusChanged, testid)
+{
+ var expectedWindow = (element.ownerDocument.defaultView == gChildWindow) ? gChildWindow : window;
+ // on Mac, form elements are not focused when clicking, except for lists and textboxes.
+ var noFocusOnMouse = !mouseWillTriggerFocus(element)
+
+ if (noFocusOnMouse) {
+ // no focus so the last focus method will be 0
+ gLastFocusMethod = 0;
+ expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerDocument.defaultView),
+ expectedWindow, null, true, testid);
+ gLastFocusMethod = fm.FLAG_BYMOUSE;
+ }
+ else {
+ expectFocusShift(() => synthesizeMouse(element, 4, 4, { }, element.ownerDocument.defaultView),
+ element.ownerDocument.defaultView,
+ expectedElement, focusChanged, testid);
+ }
+}
+
+function done()
+{
+ var opener = window.opener;
+ window.close();
+ opener.wrappedJSObject.SimpleTest.finish();
+}
+
+var pressTab = () => synthesizeKey("VK_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 textboxes 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("VK_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("VK_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("VK_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("VK_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 fires 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, getById("t" + idx), true, "mouse on element t" + idx);
+ var expectedWindow = (element.ownerDocument.defaultView == gChildWindow) ? gChildWindow : window;
+ if (element.localName == "listbox" && 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.ownerDocument.defaultView),
+ window, null, true, "mouse on scrollable element");
+ }
+
+ // focus() method
+ gLastFocusMethod = 0;
+ 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.ownerDocument.defaultView,
+ 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.ownerDocument.defaultView,
+ 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_BYMOVEFOCUS;
+ var legend = getById("legend");
+ expectFocusShift(() => legend.focus(),
+ null, getById("t28"), true, "focus method on unfocusable legend");
+ gLastFocusMethod = 0;
+ legend.tabIndex = "0";
+ expectFocusShift(() => legend.focus(),
+ null, getById("legend"), true, "focus method on focusable legend");
+ legend.tabIndex = "-1";
+ }
+
+ var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ?
+ { 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]).ownerDocument.defaultView == gChildWindow);
+ if (navigator.platform.indexOf("Mac") == -1) {
+ 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 = 0;
+ 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);
+ 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.ownerDocument.defaultView)
+ ];
+
+ // 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 = 0;
+ 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);
+
+ // 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 textbox works
+
+ setFocusTo("t1", window);
+
+ var textbox1 = document.createElement("textbox");
+ $("innerbox").appendChild(textbox1);
+
+ var textbox2 = document.createElement("textbox");
+ $("innerbox").appendChild(textbox2);
+
+ gLastFocusMethod = 0;
+ expectFocusShift(() => textbox2.focus(),
+ null, textbox2.inputField, true, "focus on textbox");
+ gLastFocusMethod = fm.FLAG_BYKEY;
+ expectFocusShift(() => synthesizeKey("VK_TAB", { shiftKey: true }),
+ null, textbox1.inputField, true, "shift+tab on textbox");
+
+ textbox1.tabIndex = 2;
+ textbox2.tabIndex = 2;
+ gLastFocusMethod = 0;
+ expectFocusShift(() => textbox2.focus(),
+ null, textbox2.inputField, true, "focus on textbox with tabindex set");
+ gLastFocusMethod = fm.FLAG_BYKEY;
+ expectFocusShift(() => synthesizeKey("VK_TAB", { shiftKey: true }),
+ null, textbox1.inputField, true, "shift+tab on textbox with tabindex set");
+
+ // ---- test for bug 618907 which ensures that canceling the mousedown event still focuses the
+ // right frame
+
+ var childContentFrame = document.getElementById("ifa")
+ childContentFrame.style.MozUserFocus = "";
+
+ var frab = childContentFrame.contentDocument.getElementById("fra-b");
+ var mouseDownListener = event => event.preventDefault();
+ frab.addEventListener("mousedown", mouseDownListener, false);
+
+ var childElementToFocus = childContentFrame.contentDocument.getElementById("fra");
+ gLastFocus = childElementToFocus;
+ gLastFocusWindow = childContentFrame.contentWindow;
+ gLastFocus.focus();
+ gEvents = "";
+
+ setFocusTo("t1", window);
+
+ gLastFocusMethod = -1;
+ expectFocusShift(() => synthesizeMouse(frab, 5, 5, { }, childContentFrame.contentWindow),
+ null, childElementToFocus, true,
+ "mousedown event canceled - chrome to content");
+
+ frab.removeEventListener("mousedown", mouseDownListener, false);
+
+ var t5 = getById("t5");
+ t5.addEventListener("mousedown", mouseDownListener, false);
+ synthesizeMouse(t5, 10, 10, { })
+ t5.removeEventListener("mousedown", mouseDownListener, false);
+ is(fm.focusedElement, childElementToFocus,
+ "mousedown event cancelled - content to chrome - element");
+ is(fm.focusedWindow, childContentFrame.contentWindow, "mousedown event cancelled - content to chrome - window");
+
+ // ---- 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.xul", "_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.parentNode.removeChild(t19);
+
+ 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.parentNode.removeChild(abs);
+
+ 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 = Components.classes["@mozilla.org/preferences-service;1"].
+ getService(Components.interfaces.nsIPrefBranch);
+ prefs.setBoolPref("accessibility.browsewithcaret", true);
+
+ synthesizeKey("VK_LEFT", { }, gChildWindow);
+ synthesizeKey("VK_LEFT", { }, gChildWindow);
+ is(fm.focusedElement, null, "move caret away from link");
+
+ synthesizeKey("VK_LEFT", { }, 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("VK_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("VK_TAB", { }),
+ window, $("o17"), true, "tab with focus on hidden content");
+
+ $("o17").hidden = true;
+ document.documentElement.getBoundingClientRect();
+ expectFocusShift(() => synthesizeKey("VK_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 textbox");
+ 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 textbox 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.ownerDocument.defaultView;
+ 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.indexOf("Windows NT 6.2") >= 0) {
+ done();
+ }
+ else {
+ window.openDialog("focus_window2.xul", "_blank", "chrome,modal", modalWindowOpened);
+ }
+}
+
+function modalWindowOpened(modalWindow)
+{
+ var elem = modalWindow.document.getElementById("other");
+ if (gPartialTabbing)
+ elem.focus();
+ else
+ synthesizeKey("VK_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.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("VK_TAB", { }, framesetWindow),
+ gNewExpectedWindow, getById("f" + idx), true, "frameset tab key f" + idx);
+ gMoveToFocusFrame = false;
+ gOldExpectedWindow = gNewExpectedWindow;
+ }
+
+ gNewExpectedWindow = framesetWindow.frames[0];
+ expectFocusShift(() => synthesizeKey("VK_TAB", { }, framesetWindow),
+ gNewExpectedWindow, getById("f1"), true, "frameset tab key wrap to start");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[3];
+ expectFocusShift(() => synthesizeKey("VK_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("VK_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("VK_F6", { ctrlKey: true }, framesetWindow),
+ gNewExpectedWindow, getById("f3"), true, "switch document forward with f6");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[2];
+ expectFocusShift(() => synthesizeKey("VK_F6", { }, framesetWindow),
+ gNewExpectedWindow, getById("f5"), true, "switch document forward with ctrl+tab");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[3];
+ expectFocusShift(() => synthesizeKey("VK_F6", { ctrlKey: true }, framesetWindow),
+ gNewExpectedWindow, getById("f7"), true, "switch document forward with ctrl+f6");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[0];
+ expectFocusShift(() => synthesizeKey("VK_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("VK_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("VK_F6", { ctrlKey: true, shiftKey: true }, framesetWindow),
+ gNewExpectedWindow, getById("f5"), true, "switch document backward with f6");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[1];
+ expectFocusShift(() => synthesizeKey("VK_F6", { ctrlKey: true, shiftKey: true }, framesetWindow),
+ gNewExpectedWindow, getById("f3"), true, "switch document backward with ctrl+tab");
+ gOldExpectedWindow = gNewExpectedWindow;
+ gNewExpectedWindow = framesetWindow.frames[0];
+ expectFocusShift(() => synthesizeKey("VK_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.indexOf("Linux") == -1) {
+ window.openDialog("focus_window2.xul", "_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 exh = false;
+ try {
+ fm.activeWindow = framesetWindow.frames[0];
+ }
+ catch (ex) { exh = true; }
+ is(exh, true, "activeWindow set to non top-level window");
+
+ exh = false;
+ try {
+ fm.activeWindow = null;
+ }
+ catch (ex) { exh = true; }
+ is(exh, true, "activeWindow set to null");
+ is(fm.activeWindow, otherWindow, "window not changed when activeWindow set to null");
+
+ 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(() => fm.activeWindow = topWindow,
+ 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 otherTextbox = otherWindow.document.getElementById("other-textbox");
+ otherTextbox.setSelectionRange(2, 3);
+ fm.activeWindow = topWindow;
+ fm.activeWindow = otherWindow;
+ is(otherTextbox.selectionStart, 2, "selectionStart after textbox focus and window raise");
+ is(otherTextbox.selectionEnd, 3, "selectionEnd after textbox focus and window raise");
+ is(fm.getLastFocusMethod(null), fm.FLAG_BYMOVEFOCUS, "last focus method after textbox focus and window raise");
+
+ fm.clearFocus(otherWindow);
+
+ // test to ensure that a synthetic event works
+ var synevent = document.createEvent("Event");
+ synevent.initEvent("focus", false, false);
+ otherTextbox.inputField.dispatchEvent(synevent);
+ is(synevent.type, "focus", "event.type after synthetic focus event");
+ is(synevent.target, otherTextbox, "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, otherTextbox, "event.target after accessing focus event in timeout");
+
+ gOldExpectedWindow = null;
+ gNewExpectedWindow = null;
+ otherWindow.close();
+ framesetWindow.close();
+
+ SimpleTest.waitForFocus(doWindowNoRootTest);
+ }
+
+ function textboxFocused(event) {
+ otherTextbox.removeEventListener("focus", textboxFocused, true);
+ setTimeout(continueTest, 0, event);
+ }
+
+ otherTextbox.addEventListener("focus", textboxFocused, true);
+ otherTextbox.focus();
+}
+
+// open a window with no root element
+var noRootWindow = null;
+function doWindowNoRootTest()
+{
+ var data = "data:application/vnd.mozilla.xul+xml," + unescape(
+ "<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>");
+
+ addEventListener("focus", doFrameSwitchingTests, true);
+ noRootWindow = window.open(data, "_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 == 0, "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 == 0, "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 == 0, "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 == 0, "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 == 0, "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 == 0, "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],
+ [inputb, "focus", inputb, frameb.contentWindow, window, frameb]];
+ fm.focusedWindow = frameb.contentWindow;
+ ok(gEventMatched && gExpectedEvents.length == 0, "frame switch using focusedWindow");
+
+ // clear the focus in an unfocused frame
+ gEventMatched = true;
+ gExpectedEvents = [];
+ fm.clearFocus(framec.contentWindow);
+ ok(gEventMatched && gExpectedEvents.length == 0, "clearFocus in unfocused frame");
+
+ // focus a sibling frame by setting focusedWindow when no element is focused in that frame
+ gEventMatched = true;
+ gExpectedEvents = [[inputb, "blur", null, frameb.contentWindow, window, frameb],
+ [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 == 0, "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 == 0, "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 == 0, "clearFocus in parent frame");
+
+ // clear the focus in an unfocused child frame
+ gEventMatched = true;
+ gExpectedEvents = [];
+ fm.clearFocus(framed.contentWindow);
+ ok(gEventMatched && gExpectedEvents.length == 0, "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()
+{
+ var t20 = getById("t20");
+ t20.focus();
+
+ gChildWindow.addEventListener("focus",
+ function(event) {
+ if (event.target == t20) {
+ is(fm.focusedElement, t20, "focus restored after history back"); done();
+ }
+ }, true);
+
+ // make sure that loading a new page and then going back maintains the focus
+ gChildWindow.location = "data:text/html,<script>window.onload=function() {setTimeout(function () {SpecialPowers.wrap(window).back();}, 0);}</script>";
+}
+
+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"/>
+ <listbox id="t5" label="tabindex = 0" tabindex="0" rows="1">
+ <listitem/>
+ </listbox>
+ <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="tabindex = -1" tabindex="-1"/>
+ <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"/>
+ <listbox id="t3" style="-moz-user-focus: normal;" label="tabindex = 2" tabindex="2" rows="1">
+ <listitem/>
+ </listbox>
+</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="tabindex = -1" tabindex="-1"/>
+ <dropmarker id="o10" value="tabindex = 0" tabindex="0"/>
+ <dropmarker id="o12" value="tabindex = 2" tabindex="2"/>
+ <dropmarker id="t9" accesskey="r" style="-moz-user-focus: normal;" value="no tabindex" />
+ <dropmarker id="t10" style="-moz-user-focus: normal;" value="tabindex = -1" tabindex="-1" />
+ <dropmarker id="t11" style="-moz-user-focus: normal;" value="tabindex = 0" tabindex="0" />
+ <dropmarker id="t12" style="-moz-user-focus: normal;" value="tabindex = 2" tabindex="2" />
+ <dropmarker id="o14" style="-moz-user-focus: ignore;" value="no tabindex"/>
+ <dropmarker id="o16" style="-moz-user-focus: ignore;" value="tabindex = -1" tabindex="-1"/>
+ <dropmarker id="n1" style="-moz-user-focus: none;" value="tabindex = 0" tabindex="0"/>
+ <dropmarker id="n3" style="-moz-user-focus: none;" value="tabindex = 2" tabindex="2"/>
+</hbox>
+</vbox>
+<browser id="childframe" type="content" src="child_focus_frame.html" width="300" height="195"/>
+<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"/>
+ <textbox 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"/>
+<listbox id="last" width="20" rows="1"/>
+
+<iframe id="ifa" width="40" height="60" style="-moz-user-focus: ignore;" 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" width="20" height="20" style="-moz-user-focus: ignore;"
+ src="data:text/html,&lt;input id=frd&gt;&lt;/iframe&gt;"/>
+
+</hbox>
+</window>
diff --git a/dom/tests/mochitest/chrome/window_focus_docnav.xul b/dom/tests/mochitest/chrome/window_focus_docnav.xul
new file mode 100644
index 000000000..a4e0a5691
--- /dev/null
+++ b/dom/tests/mochitest/chrome/window_focus_docnav.xul
@@ -0,0 +1,126 @@
+<?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 type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<textbox id="textbox1"/>
+<textbox id="textbox2"/>
+
+<panel id="panel" onpopupshown="runTests(this, 1);"
+ onpopuphidden="noChildrenTest()">
+ <textbox id="p1textbox" value="Popup1"/>
+</panel>
+<panel id="panel2" onpopupshown="runTests(this, 2);" onpopuphidden="document.getElementById('panel').hidePopup()">
+ <textbox id="p2textbox" value="Popup2"/>
+</panel>
+
+<browser id="browser" type="content" src="focus_frameset.html" width="500" height="400"/>
+
+<script type="application/javascript">
+<![CDATA[
+
+var fm = Components.classes["@mozilla.org/focus-manager;1"].
+ getService(Components.interfaces.nsIFocusManager);
+
+function is(l, r, n) { window.opener.wrappedJSObject.SimpleTest.is(l,r,n); }
+function ok(v, n) { window.opener.wrappedJSObject.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.parentNode.removeChild(browser);
+
+ let textbox1 = document.getElementById("textbox1");
+ let textbox2 = document.getElementById("textbox2");
+
+ textbox2.focus();
+ next(window, textbox1.inputField, "Focus forward when no child documents");
+ next(window, textbox1.inputField, "Focus forward again when no child documents");
+
+ textbox2.focus();
+ previous(window, textbox1.inputField, "Focus backward when no child documents");
+ previous(window, textbox1.inputField, "Focus backward again when no child documents");
+
+ done();
+}
+
+function done()
+{
+ var opener = window.opener;
+ window.close();
+ opener.wrappedJSObject.SimpleTest.finish();
+}
+
+function previous(expectedWindow, expectedElement, desc)
+{
+ synthesizeKey("VK_F6", { shiftKey: true });
+ is(fm.focusedWindow, expectedWindow, desc);
+ is(fm.focusedElement, expectedElement, desc + " element");
+}
+
+function next(expectedWindow, expectedElement, desc)
+{
+ synthesizeKey("VK_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").inputField, "First into popup 1 with " + popupCount);
+
+ if (popupCount == 2) {
+ next(window, document.getElementById("p2textbox").inputField, "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").inputField, "First back from popup 2 with " + popupCount);
+ }
+
+ previous(window, document.getElementById("p1textbox").inputField, "First back from popup 1 with " + popupCount);
+ }
+
+ previous(window, document.getElementById("textbox1").inputField, "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.opener.wrappedJSObject.SimpleTest.waitForExplicitFinish();
+ window.opener.wrappedJSObject.SimpleTest.waitForFocus(
+ function() { runTests(null, 0); },
+ document.getElementById("browser").contentWindow);
+}
+
+]]></script>
+
+</window>
diff --git a/dom/tests/mochitest/crypto/mochitest.ini b/dom/tests/mochitest/crypto/mochitest.ini
new file mode 100644
index 000000000..cb87de139
--- /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 000000000..bbaddc5a2
--- /dev/null
+++ b/dom/tests/mochitest/crypto/test_getRandomValues.html
@@ -0,0 +1,212 @@
+<!DOCTYPE HTML>
+<html><head>
+ <title>Test window.crypto.getRandomValues</title>
+ <script type="text/javascript" src="/MochiKit/packed.js"></script>
+ <script type="text/javascript" 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, false);
+ 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 000000000..fdca1c213
--- /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, false);
+ </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 000000000..8ffaa87a9
--- /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 000000000..3a74b32d1
--- /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/framed_location.html b/dom/tests/mochitest/dom-level0/framed_location.html
new file mode 100644
index 000000000..a2b65906f
--- /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 000000000..61243b322
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/idn_child.html
@@ -0,0 +1,101 @@
+<!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))
+ {
+ // XXX should really be IDN (bug 414090)
+ //if (domain !== "sub1.exaмple.test")
+ // message += " wrong-initial-domain(" + domain + ")";
+ // for now expect the punycode value
+ if (domain !== "sub1.xn--exaple-kqf.test")
+ message += " wrong-initial-domain(" + domain + ")";
+ }
+ else
+ {
+ if (domain !== "sub1.παράδειγμα.δοκιμή")
+ 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, false);
+window.addEventListener("load", run, false);
+ </script>
+</head>
+<body>
+<h1 id="location">Somewhere!</h1>
+</body>
+</html>
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 000000000..7406086ad
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/innerWidthHeight_script.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="width=320,height=320" />
+ <title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title>
+ <script class="testbody" type="text/javascript">
+ function runSubTest()
+ {
+ var oldWidth = window.innerWidth;
+ var oldHeight = window.innerHeight;
+
+ /* Test that return values are now from viewport */
+ window.opener.is(window.innerWidth, 320, "innerWidth is css viewport width");
+ window.opener.is(window.innerHeight, 320, "innerHeight is css viewport height");
+
+ window.innerWidth = 300;
+ window.opener.is(window.innerWidth, 300, "innerWidth returns value that was set");
+ window.innerWidth = oldWidth;
+
+ window.innerHeight = 300;
+ window.opener.is(window.innerHeight, 300, "innerHeight returns value that was set");
+ 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 000000000..595fcd281
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/mochitest.ini
@@ -0,0 +1,19 @@
+[DEFAULT]
+support-files =
+ child_ip_address.html
+ file_crossdomainprops_inner.html
+ file_location.html
+ framed_location.html
+ idn_child.html
+ innerWidthHeight_script.html
+
+[test_crossdomainprops.html]
+[test_innerWidthHeight_script.html]
+skip-if = toolkit == 'android' # Bug 1075071 - Permafail on Android
+[test_location.html]
+[test_location_framed.html]
+[test_location_getters.html]
+[test_location_sandboxed.html]
+[test_location_setters.html]
+[test_setting_document.domain_idn.html]
+[test_setting_document.domain_to_shortened_ipaddr.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 000000000..b18bb07d9
--- /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 type="text/javascript" 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 000000000..55b38b527
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_innerWidthHeight_script.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title>
+ <script type="text/javascript" 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],
+ ["dom.meta-viewport.enabled", true ]]}, 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 000000000..49bbb0491
--- /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 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>
+<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 000000000..9d57ec943
--- /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 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>
+ 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 000000000..f5f44835d
--- /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 type="text/javascript" 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 000000000..d22e2dd33
--- /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 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>
+ 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 000000000..eb159c7ff
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_location_setters.html
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=639720
+-->
+<head>
+ <title>Test for Bug 639720</title>
+ <script type="application/javascript" 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 tests = [
+ { url: "data:text/plain,1" },
+ { url: "data:text/plain,2",
+ useDocument: true },
+ { prepURL: "http://www.example.com",
+ url: "data:text/plain,3" }
+];
+
+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_setting_document.domain_idn.html b/dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html
new file mode 100644
index 000000000..b2e36dbbf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html
@@ -0,0 +1,211 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Setting document.domain and IDN</title>
+ <script type="application/javascript" 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 testing all gets a bit complicated here; the problem is that our
+document.domain implementation will do a suffix comparison of the value to which
+it's being set against the current URI's base domain (where "base domain" is
+defined as the effective TLD plus one; see nsIEffectiveTLDService.idl). Seems
+simple enough, right? Wrong.
+
+The problem, as usual, is IDN. Our current, wholly-inadequate solution to
+preventing Unicode domain-name spoofing is done at the level of the URL
+implementation, not at the presentation level. However, the value of the
+base domain for the current URI is always calculated in punycode; if the
+provided domain is one which is whitelisted, we'll get an IDN name and the
+suffix-comparison will fail. Nice great big mess, huh?
+
+Anyway: "test" currently fits the bill as a TLD which is not whitelisted, while
+"δοκιμή" (the Greek IDN TLD for "test") fits the bill as a TLD which is
+whitelisted. RFC 2606 reserves "test" for DNS testing, so nobody's going to
+clamor for it to be whitelisted any time soon. The latter is as of February
+2008 undergoing testing for IDN TLDs, and it's at least temporarily whitelisted
+for now. Once the testing period ends the latter's probably going to be
+un-whitelisted, so we're going to have to do a careful bit of stepping to ensure
+that in the future this test tests what it was intended to test (and, until
+bug 414090 is fixed, that it doesn't break when the Greek TLD is
+un-whitelisted).
+
+After bug 722299 the IDN whitelist is expected to go away (bug
+843689), but bug 414090 still applies, mutatis mutandis. The test has
+been changed to use exaмple.test instead (with a Cyrillic м), which
+will fail the mixed-script tests and use punycode.
+-->
+
+<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))
+ {
+ // XXX bug 414090
+ // The value of MessageEvent.origin with postMessage *should* always be IDN;
+ // unfortunately, given our current setup for dealing with Unicode-based
+ // domain-name spoofing, whether a domain is in the safe-for-IDN whitelist
+ // affects the value of this property (likewise for window.location,
+ // document.location, document.domain, and probably a slew of other
+ // things). :-(
+ //
+ // These two tests should illustrate what currently happens and what should
+ // happen once bug 414090 is fixed.
+ todo_is(evt.origin, "http://sub1.exaмple.test", "wrong sender");
+ todo_isnot(evt.origin, "http://sub1.xn--exaple-kqf.test", "wrong sender");
+ }
+ else
+ {
+ // We're receiving data from the Greek IDN name; since that TLD is
+ // whitelisted for now, the domain we get isn't going to be punycoded.
+ is(evt.origin, "http://sub1.παράδειγμα.δοκιμή", "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 run()
+{
+ var target = window.frames.idnKidWhitelist;
+ target.postMessage("idn-whitelist", "http://sub1.παράδειγμα.δοκιμή");
+
+ // Double-timeouts account for 1) delay for message to be received by target
+ // window and 2) delay for response from target window to be received by this
+ // window.
+
+ setTimeout(function()
+ {
+ setTimeout(function()
+ {
+ ok(gotIDNWhitelist, "IDN whitelist message not received");
+
+ var target = window.frames.punycodeKidWhitelist;
+ target.postMessage("punycode-whitelist", "http://sub1.παράδειγμα.δοκιμή");
+
+ setTimeout(function()
+ {
+ setTimeout(function()
+ {
+ ok(gotPunycodeWhitelist, "punycode whitelist message not received");
+
+ var target = window.frames.idnKidNoWhitelist;
+ target.postMessage("idn-nowhitelist", "http://sub1.exaмple.test");
+
+ setTimeout(function()
+ {
+ setTimeout(function()
+ {
+ ok(gotIDNNoWhitelist, "IDN no-whitelist message not received");
+
+ var target = window.frames.punycodeKidNoWhitelist;
+ target.postMessage("punycode-nowhitelist",
+ "http://sub1.exaмple.test");
+
+ setTimeout(function()
+ {
+ setTimeout(function()
+ {
+ ok(gotPunycodeNoWhitelist,
+ "punycode no-whitelist message not received");
+
+ SimpleTest.finish();
+ }, 0);
+ }, 0);
+ }, 0);
+ }, 0);
+ }, 0);
+ }, 0);
+ }, 0);
+ }, 0);
+}
+
+window.addEventListener("message", receiveMessage, false);
+window.addEventListener("load", run, false);
+</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 000000000..5af14b8cf
--- /dev/null
+++ b/dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>document.domain can't be meaningfully set on pages at IP address hosts</title>
+ <script type="application/javascript" 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 name="child" src="http://127.0.0.1:8888/tests/dom/tests/mochitest/dom-level0/child_ip_address.html"></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, false);
+</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 000000000..3c5aed505
--- /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 000000000..a68242d4f
--- /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 000000000..d846a8a8e
--- /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 000000000..f98d0be11
--- /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 000000000..89f26f6c7
--- /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 000000000..8a5d8a862
--- /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 000000000..85c06931d
--- /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 000000000..9acf75049
--- /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 000000000..cd0cc47f9
--- /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 000000000..16d4eb095
--- /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 000000000..2df9a7415
--- /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 000000000..02a994d57
--- /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 000000000..77c9b5bd2
--- /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 000000000..f89c5107d
--- /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 000000000..e69de29bb
--- /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 000000000..e69de29bb
--- /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 000000000..ffee223eb
--- /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 000000000..ca358b2fe
--- /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 000000000..63c2abfa6
--- /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 000000000..0102078c0
--- /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 000000000..f3d0fba35
--- /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 000000000..f8073c836
--- /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 000000000..df96124a8
--- /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 000000000..9b3fef1bd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f64b9ac6c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..328294812
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..39dc6b493
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e73129487
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9cc1130b5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5d9fbad2e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..189dcee07
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4c026a910
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..77b1998c0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1456ba150
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..261d343d4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..af3246df3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3694d340f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8a681e7d4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cced0c8db
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1f1c04467
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0b11e9c23
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..05b3ba5a4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..aec6a64f8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d5bc6b82b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ac99df099
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2988b6950
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..acd752787
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b471b6d40
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..175a8fb42
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d0e4a28f5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..209ed94f3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..15cb913dd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7df91d23e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..213fae1fd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7c277290b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8a2455a69
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3a8a9a6f8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a5d5186d0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4c69e7256
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..62926fb4a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a3e83f90c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4f42a2eb8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..de6c069d5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e6a79c262
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..499c1402e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..056a305a5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..747e780d0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..03fddbdbe
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..be21dcafa
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d4f5498ac
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8a0440845
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..84c7f50dc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9866d1529
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..318a13e09
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..96b08a357
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d3ad0e49a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a7ef758c1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..810d47299
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b6a850b31
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a00f900eb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..61b14d643
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9901be1a7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..368cd9a60
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3f544bc82
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0d04592f5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..844570c21
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a6b20f321
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..897c5d534
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..47b1446bc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9994130b8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cb0179ad9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..decbeda93
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0115b9a2c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..eee49dcae
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1e3d3cd63
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..177fbf694
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3b405e5fc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8238f1608
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..482ae6ee1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..348549df0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..408bc3b14
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..199142f05
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6729d6e6e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..088d28e36
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3202832d9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c891a2655
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..534b31d05
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..54fe4259e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3ef119446
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f4b5ea630
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..207f53ec4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..15f4eddd8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..36b1c0919
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ac18998e2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..758464823
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..206b1dd2e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..be53e7f6b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..832289b1c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..198e56ef6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8ea49014b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5d4e395f8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..696922439
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..99fca9c1e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d0e5f290f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b66f7aee0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cf9c041dc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e09eee1c9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9f89ba0f3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..03e76d57c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..93f8e0df5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..35190c450
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ef39341a4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..43f20ad42
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d5b4f46b1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..60837ebbd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..16b942cd2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7b55d24dc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..397c47040
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..149cef9e4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0ae2532d8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0b267bb5f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ba735d9cb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8c45632a9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7a0edd631
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..eed17f9a1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..510e4eaee
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8b884c158
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..87c8c1ff4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c10a06135
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4685a803e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..72fecbc38
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f6418461f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..04a0454fd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..81ecad183
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..62cd8282a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2e3775427
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b71773100
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..82185283f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0575d0d2a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3683306b0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..aea835972
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..68f508b50
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..1bc17d7f9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f7f9f556d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..2ae4eed71
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6a1801da1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..7bdc870d0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8db39fe78
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..eee8f1221
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3dd205616
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a49250df1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..1851eb5fc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..bae48e2a3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cd99af1e0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..16318dcf2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ff7c30f80
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..9b2cab6d7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d6b777e41
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..81bc1f89f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3e6ce31fe
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d6a49395d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..fbbbc05b0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ff5110773
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..bdfc89e49
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..714c4e44c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..86fdc3f8c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ae13b4b0c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6181063c3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..597284de1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..2e287a983
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a1b03ed53
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ddef0805d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6cbf7038c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..e40e72079
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ecf3b87b5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cee93acf1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..491182333
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..86c6c70f7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cdd2e0d48
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5257681a7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..0a7ecbce7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..7e9809a3c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..af891296f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..00162b181
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..61b18e656
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3cc73e6b1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..38d40b252
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b0bdd4982
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cad8fd05f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..06038088c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..abaf7d637
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a9a494375
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5a35f7186
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d9a22c6e7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..643daf723
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a4794d1d6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b643e453a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..4fc0984de
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..2034082c2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..fbaab0c7d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3d55e1fc7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..387496df9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..dcf34b8ca
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..db80186ca
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..2b6c3b164
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..995a72068
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..480cba028
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3dca397ee
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8e26c7a6d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ff0929d79
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..15a0e1d2c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..32a2b9712
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..4dab8c93b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f62371f21
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d57aabdaf
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a0ffb428f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..e594d7c61
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6697c13de
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cb1f98824
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..051a5a69b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..df8e972d9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ee802083e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b07f489e3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b9f0963f4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..800af234f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..c4439bf30
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..e8cbe831f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..27b4c5545
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..265e91297
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cec3d41ba
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..57b534964
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d910c860c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..c0bd974c6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..006a66329
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..93b68ef27
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..35fe10436
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..34bd1a755
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d3e560b34
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b25cb569b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f21fd784e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8cc33159b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8542e2b70
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..36a74e5ff
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..20fb5db3b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ae474fef8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..52ae2522d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..487705dd9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..054c62c51
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a45289bad
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6599bcecc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..44797b230
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5ee9cf692
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..be094fca1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a6182f09f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f879869a6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3d8803aac
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a744524b4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a8a2e6cfa
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3f1aaedd0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..944ea875b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ce50b859f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6047e8f44
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b823e6043
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..13635d608
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d13350f78
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..836eb6a9c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..65d2e900d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d12b9b474
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..27235f0be
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5b97212b8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..0da2defbf
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a57b0e15f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..33788f699
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b0eb2f6c7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a873966eb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..c67fcfa74
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5ffa1fd6e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cef50cac6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..65b241e8c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..bbafbefb3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..745608e11
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ef18e1d1c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..af3c79edd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..fd56e803a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..925c2c1f5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..80535c192
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b3a3c0931
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..31b17ede1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..c9fa9ea30
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8ff7094f0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d48c2c05e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..da9df810d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..498d7dc8b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..0af7c3d3b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..da087ebe8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..05488a950
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f9bf1d9f5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..eef5f4444
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..fa9980aab
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..886b4180d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..0ffdf9ba3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..e5fcea721
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..eda0f5324
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..bc59d6cd9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6819e5ec1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..428636e69
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..81ee9d74a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..34317930d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..fde0564bb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..616f84241
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f0f06c38a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..08198b4db
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..aec8d6bd9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..df0a90318
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..00f8eafa8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a7d0eaf3a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..846a74f63
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..1c52e7f0f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..cc7034683
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..781edd985
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d41582a6b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..80517629a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8e8560675
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..26f3b0d8b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..1a50d67e4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8e2bdc6dc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f461e910e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..127019cd3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..0e66a4af5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b11cffb5d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b04101d8d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5a98aa8fc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..6d3003cb2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d49bd0709
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..95a5ac0a5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..be6d5560c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..df6e41a88
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..d9152759b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3f035f962
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..a8d3a1f22
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3e010a1f6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f4862ec49
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..43a6ad8e2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..0f4958dd9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..664da6888
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ab66d7bb9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..fa5b8237b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..c7098684b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..18de09027
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..83d9750d6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..ad200e785
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..391a8bfc2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..fc3eb9471
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..688589f8e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..44fc2ca4b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..0b3edf712
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b999999cb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b5f5edcb9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..13f9499f4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..10c231d8d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..f560db193
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..98755130f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8d33aaf8f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3124f3135
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5fe880ad0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..b5bb9591d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..25bcdcdd6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..5ff26f166
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3d5b9d726
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..346c2074a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..eae25488c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..8c611b3f3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b68121e3f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b653414d4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2675748c4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f8bbb64cc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6f76d93a8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fbba531b0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e3891c2a0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..54aa24bfa
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..db27004f8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6e4fd461b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..37972b3f0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f48133672
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c3502df8f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1c97e5f9f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..067ea27fb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e7e15c799
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a55ed496c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9aa208421
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..20c267705
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2a7c37f36
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..156c6c0bd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..939f1e87e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..68ca5b13c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..baf0ca74b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..67c36650f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b8be973a1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..90de7fbf1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8cb88a8e0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cd751d465
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3393010b2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..73ef7a549
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3bc9e6998
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2ff891483
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..26b2755a3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f9450a582
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..28263f763
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..160bbfc9a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e1a501754
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c29734aa0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fa88d19fe
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5ab832046
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..21cb66bee
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b526f253f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d10ceff26
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..42b5ca806
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fadb72db1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..969e375b5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..95f1bf211
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ab773e7d6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3ca45f9ce
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cd1f7580d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d41332a2d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9157ceaf7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f66310dad
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1988d2dc1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ec18e1014
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1ed7e0d89
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bd511fab7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..904dd78fd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0583a632f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..93413fcbd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0407631da
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..956a53f12
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d92da82c2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5dbd92d8e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d85716823
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d0bc25f5b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6e710ed0b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e0abc9f33
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fb34fff21
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ded36e207
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f25f4e19d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..eb0183cfb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..378a096b7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..dd7c8b247
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..75e3a6656
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d9662d437
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e032723eb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..254513244
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..48889f472
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e86fa1d02
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ff6163dc9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fd5500884
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2778f86bc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5e60a07da
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0b4c3337f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c7d62a193
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..77b284ad1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..dda46d893
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a267068ef
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7cc0e00ff
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4be8152af
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c1823ab4d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4e48b5180
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ee569a134
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9de02d0c5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2be04bd30
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..167cdf7b3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d5c9dbae6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b570ac221
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bb256ffc8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6d0a15f03
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..449b7b011
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..035effc4b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ecf825237
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8abb4aa6a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..031830e6c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..92d571afe
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c2a0af936
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..40216fe99
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f81e0ebf6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..08a1ea651
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..be26d1345
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bd6f14b3b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e50aeb024
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6e43346b7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..28b27d252
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..56217850e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..73d529617
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3d38922eb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8bfdd64f8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e5f68af01
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a0d39e6e7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..69cbdf6a5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..125a91459
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..96dea2fc6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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");
+ 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 000000000..21a27517f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fa85fbfa9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c86e14703
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..aa06be710
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..31820c33b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..661f116a2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..36ce92610
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..23fef7c77
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..40f84e8d3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..323f9c12d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e42dbd49e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..83d3e2d2a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5e429b5bb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0906cc44b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cccf43efc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a0bc37c2a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bdcaa4035
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5f49a49b9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..343530ea1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5d5ba1c80
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ddf07fbda
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2ac67225d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4c31217e6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..39dee3e2b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4e0f2b05c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..82fac3b36
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7fd2332bf
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..124062ea5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8a4428221
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7a66f0c6a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5c433e124
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..40282f306
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2d2b2cf64
--- /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 000000000..cc5a0da12
--- /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 000000000..9acf75049
--- /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 000000000..cd0cc47f9
--- /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 000000000..2df9a7415
--- /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 000000000..2df9a7415
--- /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 000000000..e69de29bb
--- /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 000000000..01aa823f3
--- /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 000000000..054a5e180
--- /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 000000000..02a994d57
--- /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 000000000..fd67323a4
--- /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 000000000..f89c5107d
--- /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 000000000..0bac8f253
--- /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 000000000..6f89dad04
--- /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 000000000..d3d9a13dd
--- /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 000000000..7643773fc
--- /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 000000000..7a7c26ee8
--- /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 000000000..1cb1459e2
--- /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 000000000..e69de29bb
--- /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 000000000..e69de29bb
--- /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 000000000..ffee223eb
--- /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 000000000..ca358b2fe
--- /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 000000000..63c2abfa6
--- /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 000000000..dc5d7936c
--- /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 000000000..fefb77f4f
--- /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 000000000..3cad0fbae
--- /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 000000000..b8b178ae1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-core/mochitest.ini
@@ -0,0 +1,268 @@
+[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]
+[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 000000000..043ff3faf
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..243d6ceaa
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3ab7462cc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9b3ace393
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b4c72dbf4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..aea5a3a6e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 = (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/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 000000000..3a609134b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1b18dda11
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4e95f561a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..da7e60200
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..562bc62f9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ffc032082
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 = (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/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 000000000..170a66a05
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c730b3294
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cb5e7dabc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2974f6099
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..aa38114a5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6e6a77761
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d52ce64e1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 = (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/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 000000000..efb7e653a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2da6fc61f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e15464d3b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 = (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/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 000000000..b1c6ce36d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..44bdcb32d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..17912b94d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5f44261ca
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..52be13492
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2f7dd65ed
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d03b24ee8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3aab4dddb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..89e34b874
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ 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 000000000..ee3309114
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ded4cee6b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..811b2752a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..407d8cf56
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..11592c338
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0d32545ed
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a8fcb4777
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e5ef578cb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..68558acb4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1959f445a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9d164d406
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bb3a6df8e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5c415dafb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bd482e0d8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a2401083c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..035daf1c9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3d18a8073
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..dde6735fc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f4b7170a5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f77c6155a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fe6978556
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7643e638a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..336cb79fb
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5a206d8ec
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..800d89a7e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7019cc86e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1f3d50b03
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a6cfcfae8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8c538b6a2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8d68aa029
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e6b219748
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8f5bad4f1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b46fc5e75
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d84175d96
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3a52ada75
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f29478cb3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..25c03cfb7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..daebde1ba
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8b7184b8f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b87b2150c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 = (typeof(ex.code) != 'undefined' && ex.code == 14);
+ }
+ 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 000000000..76f8afacd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..88c02d32a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..657644de4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..070bb15b8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..84d6f57d9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1ff390667
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0a7f54897
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..34565cec7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4c1324ca7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..636832a62
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1e6f30fe1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..688bf430a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5996c8b99
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a2bd1889d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c917dac10
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8c6bd21da
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7c62c8edd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fd58fac0d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9b60c7397
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..02211fb1b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4b6d0529e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e5d2ca664
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0425dffe6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..22f7d98e8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4a6d627fd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..08eeabe1a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f42a20fc0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..011d9c207
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1bf132c1a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f010433da
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7625da69a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..063e3aedc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..01d793af9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c288dad7b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4a54a62a7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4a966f882
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5a5a33594
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9dc4b0d30
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..da8aeb9ac
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1531935fa
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..956cfd6ef
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cb335a6d1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d0d39b8f1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2a76c83b3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8f3109ce6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..27d9d7912
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..625b324b3
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..daa0bb5c8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..78cc70457
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b035e39c5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..861b2035f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..08ee0451c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3d9c686db
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ebd71c2db
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1b169ff4d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..550f38978
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2dc3e56d5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c9317e935
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..9df9a3a7c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6d5eac658
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6b3a0a1cd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6a2d9976a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..04c0ceae1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8a8a61718
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..15ef1d818
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fa4577da6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3c04b3706
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b2092e5af
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..69a30f6f8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8ec48c7be
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c41805aee
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a9b3a63af
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..20fdfba1f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..1e6f9bacd
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..3027cbca1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" 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 000000000..874d0fc98
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e58c27667
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..106d70f17
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5cae9def2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0c98f8504
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..17a9f393d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..22f9619c5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..811d93cd0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..75d15e532
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bbbc007bf
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..85790ed98
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bf2b4105e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bc02c5526
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b7f1f71e1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3a0bd2c21
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6873bcee0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bcde10bad
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b308f07a1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fed94f715
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6045008e2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5c2fcefe9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..36eeba285
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ca2e82841
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e42056eda
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..383ace83e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0e46e4827
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..bb749e745
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a43969f13
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1d77f9b14
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..499d19eab
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7938dee93
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..75e0faf8c
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2b62f117b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e1238daf9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4cfaa2f26
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c0d089cc0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2bc7cc76f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ecbef4b89
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0eecfc842
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..e9bf70cae
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..a702a3f09
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..dabc41515
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1c17dc047
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..dcee1e8b0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..da24dc5c8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..77b16acb7
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..90198122d
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ac5b28807
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cd2571217
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4a6169247
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..818bc4d20
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..eb47c037f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..640aeabf5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..fa1e8bff0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1fc4037b6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..0267a9328
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..12c21ecd4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..f88725593
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..65350e36b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cc4ebbf20
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..915b635da
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..cc8158180
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..eae9bb924
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5ce85c1f9
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..7ab21fbb4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..2bc6a7c89
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3acfd2df1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..06b727316
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..93ac1dc33
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..619552c18
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d49f0da24
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8e68fb064
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..ba57f54d0
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..873fb8abc
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..6f58738f6
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 = (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/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 000000000..6cc79cd2f
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..b723192c1
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..8d2755d37
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..235c5878a
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3738801ab
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..847417119
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1f288e092
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..60d8969e5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..1edc1d488
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..347c228f5
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..930f742db
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..d83aafe2e
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5b6b0f0a4
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..587def683
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..692df3cd2
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..5dbcab9f8
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..4baba7500
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..c22125921
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/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 000000000..3747e3962
--- /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 000000000..952e8d928
--- /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 000000000..1be575533
--- /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 000000000..1be575533
--- /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 000000000..1b04fb9ff
--- /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 000000000..096eb6014
--- /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 000000000..096eb6014
--- /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 000000000..d721cf1d9
--- /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 000000000..cf2070cf2
--- /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 000000000..cf2070cf2
--- /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 000000000..3faee91d3
--- /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 000000000..0379ed126
--- /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 000000000..43b27daef
--- /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 000000000..43b27daef
--- /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 000000000..17933091f
--- /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 000000000..dddff6849
--- /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 000000000..1e497f36c
--- /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 000000000..1e497f36c
--- /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 000000000..f1ae08161
--- /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 000000000..5476bee9e
--- /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 000000000..5476bee9e
--- /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 000000000..53d151d8b
--- /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 000000000..bc41a1d02
--- /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 000000000..bc41a1d02
--- /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 000000000..514d534fc
--- /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 000000000..3d15b902f
--- /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 000000000..3d15b902f
--- /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 000000000..6468cd018
--- /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 000000000..fa6d1b795
--- /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 000000000..fa6d1b795
--- /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 000000000..0a3a3d4e2
--- /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 000000000..99c9c1ef8
--- /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 000000000..99c9c1ef8
--- /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 000000000..c891ba4a5
--- /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 000000000..313698824
--- /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 000000000..313698824
--- /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 000000000..885202df4
--- /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 000000000..9da52c1ec
--- /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 000000000..9da52c1ec
--- /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 000000000..0e2f46091
--- /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 000000000..bf70ef845
--- /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 000000000..bf70ef845
--- /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 000000000..6b8364621
--- /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 000000000..7a1059a38
--- /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 000000000..7a1059a38
--- /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 000000000..5dec3affe
--- /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 000000000..72c6475d4
--- /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 000000000..72c6475d4
--- /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 000000000..4e6025b2d
--- /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 000000000..530b92f18
--- /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 000000000..3cc6ccf10
--- /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 000000000..3cc6ccf10
--- /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 000000000..a0c198e81
--- /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 000000000..ee996015d
--- /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 000000000..ee996015d
--- /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 000000000..312ea4420
--- /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 000000000..dcfeba133
--- /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 000000000..dcfeba133
--- /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 000000000..894e44241
--- /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 000000000..818db76bc
--- /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 000000000..818db76bc
--- /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 000000000..d8bf02424
--- /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 000000000..40d6bf0fa
--- /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 000000000..40d6bf0fa
--- /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 000000000..c44b6726d
--- /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 000000000..e639432bf
--- /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 000000000..e639432bf
--- /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 000000000..543d09efb
--- /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 000000000..48f5019cb
--- /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 000000000..bbed66fbe
--- /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 000000000..41182c9be
--- /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 000000000..bbe00fac1
--- /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 000000000..bbe00fac1
--- /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 000000000..6030ec5f5
--- /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 000000000..09008eb86
--- /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 000000000..615f23406
--- /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 000000000..f208fe055
--- /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 000000000..2035bd9c8
--- /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 000000000..2035bd9c8
--- /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 000000000..90d388c0f
--- /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 000000000..3fda259f1
--- /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 000000000..3fda259f1
--- /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 000000000..9c4faccd0
--- /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 000000000..685de3515
--- /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 000000000..685de3515
--- /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 000000000..2c91731e4
--- /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 000000000..f07d2c138
--- /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 000000000..f07d2c138
--- /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 000000000..0a44fc335
--- /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 000000000..93326c817
--- /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 000000000..93326c817
--- /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 000000000..7f302b843
--- /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 000000000..a1b101139
--- /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 000000000..a1b101139
--- /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 000000000..b4e8b270e
--- /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 000000000..40e3695b9
--- /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 000000000..40e3695b9
--- /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 000000000..ee49e443c
--- /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 000000000..c36e87d50
--- /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 000000000..b7704ad10
--- /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 000000000..b7704ad10
--- /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 000000000..0fd50ceae
--- /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 000000000..a48d9a585
--- /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 000000000..a48d9a585
--- /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 000000000..d0abc044b
--- /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 000000000..902584fde
--- /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 000000000..902584fde
--- /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 000000000..53160eeaf
--- /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 000000000..c95e6852a
--- /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 000000000..c95e6852a
--- /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 000000000..0c97b4c92
--- /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 000000000..79af81112
--- /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 000000000..79af81112
--- /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 000000000..2d4c082b4
--- /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 000000000..5a0f18c24
--- /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 000000000..5a0f18c24
--- /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 000000000..12fac9daa
--- /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 000000000..95c80048f
--- /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 000000000..95c80048f
--- /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 000000000..a636fa589
--- /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 000000000..f61a2adb9
--- /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 000000000..f61a2adb9
--- /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 000000000..e07204f1d
--- /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 000000000..9f020ff8b
--- /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 000000000..9f020ff8b
--- /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 000000000..e88fe8fc1
--- /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 000000000..bf89bbeea
--- /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 000000000..bf89bbeea
--- /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 000000000..1ab79696d
--- /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 000000000..b81432d52
--- /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 000000000..b81432d52
--- /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 000000000..31da31cdc
--- /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 000000000..824f7fc60
--- /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 000000000..824f7fc60
--- /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 000000000..44680cd72
--- /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 000000000..a41e03dd8
--- /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 000000000..a41e03dd8
--- /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 000000000..f69c9ded9
--- /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 000000000..cbe1ab6ad
--- /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 000000000..cbe1ab6ad
--- /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 000000000..a354af806
--- /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 000000000..b421ecabb
--- /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 000000000..b421ecabb
--- /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 000000000..83707c392
--- /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 000000000..8cf88d887
--- /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 000000000..8cf88d887
--- /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 000000000..d1e8743ea
--- /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 000000000..3f0419420
--- /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 000000000..3f0419420
--- /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 000000000..0da483609
--- /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 000000000..2cdb1dfe1
--- /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 000000000..2cdb1dfe1
--- /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 000000000..290e62660
--- /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 000000000..3e916eb5a
--- /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 000000000..3e916eb5a
--- /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 000000000..2a402065e
--- /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 000000000..69f652b14
--- /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 000000000..69f652b14
--- /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 000000000..6bad2b83f
--- /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 000000000..93e6c422f
--- /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 000000000..93e6c422f
--- /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 000000000..41ad0bdad
--- /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 000000000..362860b39
--- /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 000000000..ebdaa7246
--- /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 000000000..ebdaa7246
--- /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 000000000..78206240f
--- /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 000000000..491a74c6a
--- /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 000000000..491a74c6a
--- /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 000000000..c3df42432
--- /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 000000000..b8477c1f6
--- /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 000000000..b8477c1f6
--- /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 000000000..b8f151e06
--- /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 000000000..8300b90a1
--- /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 000000000..8300b90a1
--- /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 000000000..8f5d19b28
--- /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 000000000..e174c63df
--- /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 000000000..e174c63df
--- /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 000000000..f9181c739
--- /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 000000000..67b72dcc3
--- /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 000000000..67b72dcc3
--- /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 000000000..c9adef2a4
--- /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 000000000..0e8ee7f0d
--- /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 000000000..0e8ee7f0d
--- /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 000000000..c72a94899
--- /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 000000000..a69c4fec4
--- /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 000000000..a69c4fec4
--- /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 000000000..9e76a4cdb
--- /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 000000000..b901e3ce0
--- /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 000000000..b901e3ce0
--- /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 000000000..0c1a5f784
--- /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 000000000..34986508b
--- /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 000000000..34986508b
--- /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 000000000..b9aedc499
--- /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 000000000..eb6ca48ba
--- /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 000000000..eb6ca48ba
--- /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 000000000..2078ee95d
--- /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 000000000..e8ec6b55a
--- /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 000000000..e8ec6b55a
--- /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 000000000..75498e2cb
--- /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 000000000..fd9d7a5a4
--- /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 000000000..fd9d7a5a4
--- /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 000000000..ac0ecd37e
--- /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 000000000..ffee223eb
--- /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 000000000..ca358b2fe
--- /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 000000000..63c2abfa6
--- /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 000000000..c22b666d1
--- /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 000000000..06228785f
--- /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 000000000..215a4b078
--- /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 000000000..c2e96e301
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/mochitest.ini
@@ -0,0 +1,876 @@
+[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
+ files/applets/org/w3c/domts/DOMTSApplet.class
+
+[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_HTMLAppletElement01.html]
+[test_HTMLAppletElement02.html]
+[test_HTMLAppletElement03.html]
+[test_HTMLAppletElement04.html]
+[test_HTMLAppletElement05.html]
+[test_HTMLAppletElement06.html]
+[test_HTMLAppletElement07.html]
+[test_HTMLAppletElement08.html]
+[test_HTMLAppletElement09.html]
+[test_HTMLAppletElement10.html]
+[test_HTMLAppletElement11.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_HTMLDocument08.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 000000000..dc899e386
--- /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 000000000..9df631072
--- /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 000000000..8255bd306
--- /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 000000000..01342aa7a
--- /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 000000000..679063c4f
--- /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 000000000..e28bcbcdd
--- /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 000000000..6780083da
--- /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 000000000..7a615e662
--- /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 000000000..30453216f
--- /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 000000000..8b377e7da
--- /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 000000000..64e54da9b
--- /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 000000000..cf48f9dc9
--- /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 000000000..750832dd4
--- /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 000000000..7daee66eb
--- /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_HTMLAppletElement01.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement01.html
new file mode 100644
index 000000000..0fd33fd3f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement01.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/HTMLAppletElement01</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement01'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 the object(Vertically
+ or Horizontally) 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-8049912
+*/
+function HTMLAppletElement01() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement01") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valign = testNode.align;
+
+ assertEquals("alignLink","bottom".toLowerCase(),valign.toLowerCase());
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement01</h2>
+<p>&lt;test name='HTMLAppletElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement01&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 the object(Vertically
+ or Horizontally) 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-8049912">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8049912</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' 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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement02.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement02.html
new file mode 100644
index 000000000..08ede82d1
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement02.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/HTMLAppletElement02</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement02'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 the alternate text for user agents not
+ rendering the normal context 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-58610064
+*/
+function HTMLAppletElement02() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement02") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ valt = testNode.alt;
+
+ assertEquals("altLink","Applet Number 1",valt);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement02</h2>
+<p>&lt;test name='HTMLAppletElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement02&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 the alternate text for user agents not
+ rendering the normal context 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-58610064">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58610064</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' obj='testNode' var='valt'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='valt' expected='"Applet Number 1"' <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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement03.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement03.html
new file mode 100644
index 000000000..98384445d
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement03.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement03</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement03'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 comma-seperated archive list.
+
+ Retrieve the archive 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-14476360
+*/
+function HTMLAppletElement03() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement03") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,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/HTMLAppletElement03</h2>
+<p>&lt;test name='HTMLAppletElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement03&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 comma-seperated archive list.
+
+ Retrieve the archive 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-14476360">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-14476360</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' 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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement04.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement04.html
new file mode 100644
index 000000000..61c48fe6e
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement04.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement04</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement04'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 the applet class file.
+
+ Retrieve the code 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-61509645
+*/
+function HTMLAppletElement04() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement04") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcode = testNode.code;
+
+ assertEquals("codeLink","org/w3c/domts/DOMTSApplet.class",vcode);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement04</h2>
+<p>&lt;test name='HTMLAppletElement04' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement04&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 the applet class file.
+
+ Retrieve the code 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-61509645">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61509645</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;code interface='HTMLAppletElement' obj='testNode' var='vcode'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcode' expected='"org/w3c/domts/DOMTSApplet.class"' <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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement05.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement05.html
new file mode 100644
index 000000000..cb524b2fb
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement05.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/HTMLAppletElement05</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement05'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 an optional base URI for the applet.
+
+ Retrieve the codeBase 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-6581160
+*/
+function HTMLAppletElement05() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement05") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vcodebase = testNode.codeBase;
+ // mozilla returns full URI here
+ // assertEquals("codebase","applets",vcodebase);
+ todo_is(vcodebase,"applets","codebase");
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement05</h2>
+<p>&lt;test name='HTMLAppletElement05' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement05&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 an optional base URI for the applet.
+
+ Retrieve the codeBase 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-6581160">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6581160</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' obj='testNode' var='vcodebase'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcodebase' expected='"applets"' <a id="codebase">id='codebase'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement06.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement06.html
new file mode 100644
index 000000000..79f3d0838
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement06.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement06</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement06'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 height.
+
+ Retrieve the height 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-90184867
+*/
+function HTMLAppletElement06() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement06") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vheight = testNode.height;
+
+ assertEquals("heightLink","306",vheight);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement06</h2>
+<p>&lt;test name='HTMLAppletElement06' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement06&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 height.
+
+ Retrieve the height 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-90184867">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90184867</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' obj='testNode' var='vheight'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vheight' expected='"306"' <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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement07.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement07.html
new file mode 100644
index 000000000..6ba8f9ce0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement07.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/HTMLAppletElement07</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement07'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 and examine it's value.
+
+* @author NIST
+* @author Mary Brady
+* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-1567197
+*/
+function HTMLAppletElement07() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement07") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,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/HTMLAppletElement07</h2>
+<p>&lt;test name='HTMLAppletElement07' 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;HTMLAppletElement07&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 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-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-1567197">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-1567197</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' 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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement08.html
new file mode 100644
index 000000000..63d6800d3
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement08.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 applet.
+
+ 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-39843695
+*/
+function HTMLAppletElement08() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement08") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vname = testNode.name;
+
+ assertEquals("nameLink","applet1",vname);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement08</h2>
+<p>&lt;test name='HTMLAppletElement08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 applet.
+
+ 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-39843695">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39843695</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' obj='testNode' var='vname'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vname' expected='"applet1"' <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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement09.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement09.html
new file mode 100644
index 000000000..5a17bf466
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement09.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/HTMLAppletElement09</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement09'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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, applet or object.
+
+ 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-22637173
+*/
+function HTMLAppletElement09() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement09") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,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/HTMLAppletElement09</h2>
+<p>&lt;test name='HTMLAppletElement09' 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;HTMLAppletElement09&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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, applet or object.
+
+ 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-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-22637173">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-22637173</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' 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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement10.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement10.html
new file mode 100644
index 000000000..66fc5882a
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement10.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement10</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement10'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page 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 regular width.
+
+ 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-16526327
+*/
+function HTMLAppletElement10() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement10") != 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", "applet");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vwidth = testNode.width;
+
+ assertEquals("widthLink","301",vwidth);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement10</h2>
+<p>&lt;test name='HTMLAppletElement10' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement10&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 regular width.
+
+ 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-16526327">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-16526327</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='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='applet' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<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='HTMLAppletElement' obj='testNode' var='vwidth'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vwidth' expected='"301"' <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/applet.html"></iframe>
+<br>
+</body>
+</html>
diff --git a/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement11.html b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement11.html
new file mode 100644
index 000000000..2bf88e82f
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLAppletElement11.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/HTMLAppletElement11</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLAppletElement11'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test document builder, may throw exception
+ //
+ builder = createConfiguredBuilder();
+
+ docsLoaded = 0;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ docsLoaded += preload(docRef, "doc", "applet2");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The object attribute specifies the serialized applet file.
+
+ Retrieve the object attribute and examine its value.
+
+* @author NIST
+* @author Rick Rivello
+* @author Curt Arnold
+* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93681523
+*/
+function HTMLAppletElement11() {
+ var success;
+ if(checkInitialization(builder, "HTMLAppletElement11") != null) return;
+ var nodeList;
+ var testNode;
+ var vobject;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "applet2");
+ nodeList = doc.getElementsByTagName("applet");
+ assertSize("Asize",1,nodeList);
+testNode = nodeList.item(0);
+ vobject = testNode.object;
+ // mozilla returns full uri here
+ // asertEquals("object","DOMTSApplet.dat",vobject);
+ todo_is(vobject, "DOMTSApplet.dat", "object");
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLAppletElement11</h2>
+<p>&lt;test name='HTMLAppletElement11' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLAppletElement11&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The object attribute specifies the serialized applet file.
+
+ Retrieve the object 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;contributor&gt;Curt Arnold&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-93681523">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-93681523</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vobject' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='applet2' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"applet"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;object interface='HTMLAppletElement' obj='testNode' var='vobject'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vobject' expected='"DOMTSApplet.dat"' <a id="object">id='object'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
+ for more details.</p>
+<iframe name="doc" src="files/applet2.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 000000000..33cb668b0
--- /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 000000000..c86314986
--- /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 000000000..fcfc102c6
--- /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 000000000..fd2f9ed7a
--- /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 000000000..91f422ba5
--- /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 000000000..4573ad5e9
--- /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 000000000..51a20af37
--- /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 000000000..34beaca59
--- /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 000000000..d214e9c4c
--- /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 000000000..b5301beb8
--- /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 000000000..c271e9565
--- /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 000000000..3e1fa8e48
--- /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 000000000..1aaa2e378
--- /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 000000000..1cb2e6d2f
--- /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 000000000..313430d77
--- /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 000000000..b81ef57bc
--- /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 000000000..090cf5784
--- /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 000000000..a2671e0db
--- /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 000000000..6a5549ddc
--- /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 000000000..51d5ecdb0
--- /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 000000000..eb437b66e
--- /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 000000000..3dda0c128
--- /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 000000000..a35ce44be
--- /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 000000000..121bd1625
--- /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 000000000..e3e688a6c
--- /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 000000000..a9db5018a
--- /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 000000000..250be450b
--- /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 000000000..4106a252f
--- /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 000000000..1dd77c08d
--- /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 000000000..9e5cbc4d7
--- /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 000000000..065f33a9a
--- /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 000000000..6bf2f4614
--- /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 000000000..3a808d824
--- /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 000000000..dc68289b4
--- /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 000000000..13f4ea375
--- /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 000000000..226c6e35c
--- /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 000000000..f19b0b4a9
--- /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 000000000..d83de76af
--- /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 000000000..6e345f695
--- /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 000000000..3d537a71c
--- /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 000000000..b5a1e2bbf
--- /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 000000000..274877d02
--- /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 000000000..b3036dfff
--- /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 000000000..ea6cd77bd
--- /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 000000000..942c8c914
--- /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 000000000..82f8a6cae
--- /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_HTMLDocument08.html b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument08.html
new file mode 100644
index 000000000..2877bf8c0
--- /dev/null
+++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument08.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/HTMLDocument08</title>
+<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
+<script src="DOMTestCase.js" type="text/javascript"></script>
+<script type="text/javascript">
+// expose test function names
+function exposeTestFunctionNames()
+{
+return ['HTMLDocument08'];
+}
+
+var docsLoaded = -1000000;
+var builder = null;
+
+//
+// This function is called by the testing framework before
+// running the test suite.
+//
+// If there are no configuration exceptions, asynchronous
+// document loading is started. Otherwise, the status
+// is set to complete and the exception is immediately
+// raised when entering the body of the test.
+//
+function setUpPage() {
+ setUpPageStatus = 'running';
+ try {
+ //
+ // creates test 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-with-applet");
+
+ if (docsLoaded == 1) {
+ setUpPage = 'complete';
+ }
+ } catch(ex) {
+ catchInitializationError(builder, ex);
+ setUpPage = 'complete';
+ }
+}
+
+
+
+//
+// This method is called on the completion of
+// each asychronous load started in setUpTests.
+//
+// When every synchronous loaded document has completed,
+// the page status is changed which allows the
+// body of the test to be executed.
+function loadComplete() {
+ if (++docsLoaded == 1) {
+ setUpPageStatus = 'complete';
+ runJSUnitTests();
+ SimpleTest.finish();
+ }
+}
+
+
+/**
+*
+ The applets attribute returns a collection of all OBJECT elements that
+ include applets abd APPLET elements in a document.
+
+ Retrieve the applets 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-85113862
+*/
+function HTMLDocument08() {
+ var success;
+ if(checkInitialization(builder, "HTMLDocument08") != null) return;
+ var nodeList;
+ var testNode;
+ var vapplets;
+ var vlength;
+ var doc;
+
+ var docRef = null;
+ if (typeof(this.doc) != 'undefined') {
+ docRef = this.doc;
+ }
+ doc = load(docRef, "doc", "document-with-applet");
+ vapplets = doc.applets;
+
+ vlength = vapplets.length;
+
+ assertEquals("length",2,vlength);
+
+}
+
+</script>
+</head>
+<body>
+<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument08</h2>
+<p>&lt;test name='HTMLDocument08' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument08&lt;/title&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
+ The applets attribute returns a collection of all OBJECT elements that
+ include applets abd APPLET elements in a document.
+
+ Retrieve the applets 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-85113862">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85113862</a>'/&gt;
+<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vapplets' 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;applets interface='HTMLDocument' obj='doc' var='vapplets'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;length interface='HTMLCollection' obj='vapplets' var='vlength'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vlength' expected='4' <a id="length">id='length'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
+</p>
+<p>
+ Copyright (c) 2001-2004 World Wide Web Consortium,
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University). All
+ Rights Reserved. This program is distributed under the W3C's Software
+ Intellectual Property License. This program is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.
+ </p>
+<p>See W3C License <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-with-applet.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 000000000..bab6a50f0
--- /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 000000000..c9b128b99
--- /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 000000000..58dee1d5d
--- /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 000000000..0788ec7b3
--- /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 000000000..5ccb3fdd4
--- /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 000000000..a0e0080cd
--- /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 000000000..b5e8940dd
--- /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 000000000..98946ccd4
--- /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 000000000..e922831ad
--- /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 000000000..737f79ad8
--- /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 000000000..c7a67609d
--- /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 000000000..81dbb8a10
--- /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 000000000..cd6d9a5a7
--- /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 000000000..33f5659ea
--- /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 000000000..b3e0d001d
--- /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 000000000..154524f9d
--- /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 000000000..99c425562
--- /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 000000000..5365551c1
--- /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 000000000..c4390b512
--- /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 000000000..7ccf12b5e
--- /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 000000000..8738e2cdf
--- /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 000000000..42ed5bd09
--- /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 000000000..dee669c99
--- /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 000000000..b8ca6a8da
--- /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 000000000..8162c4ce0
--- /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 000000000..9a987c945
--- /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 000000000..d1aa2e053
--- /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 000000000..2aa66e4d3
--- /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 000000000..a7fd6bcb0
--- /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 000000000..93cc16acd
--- /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 000000000..1de43c43d
--- /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 000000000..34549391e
--- /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 000000000..9173777d5
--- /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 000000000..cc7bb6554
--- /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 000000000..8acf8ce73
--- /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 000000000..8a4105f4c
--- /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 000000000..091c72bdf
--- /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 000000000..ab360118a
--- /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 000000000..7dc20c894
--- /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 000000000..8e56fd081
--- /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 000000000..68961a607
--- /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 000000000..69d129921
--- /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 000000000..d386dd405
--- /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 000000000..426000c4c
--- /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 000000000..b71fbb441
--- /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 000000000..d947b0742
--- /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 000000000..b4beea87c
--- /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 000000000..e5da51a91
--- /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 000000000..e2bec40d6
--- /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 000000000..03d51cb31
--- /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 000000000..7ca302486
--- /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 000000000..512100c98
--- /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 000000000..ce9589a05
--- /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 000000000..93a8c76b4
--- /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 000000000..f0ff2117d
--- /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 000000000..166b0fe14
--- /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 000000000..4aefeef5d
--- /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 000000000..26c779f80
--- /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 000000000..53d4e6a43
--- /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 000000000..27cd339f0
--- /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 000000000..d64f1fd21
--- /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 000000000..b0377bcd2
--- /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 000000000..7d35fe268
--- /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 000000000..52fcc7b50
--- /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 000000000..a63421924
--- /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 000000000..db9783553
--- /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 000000000..9986bfef1
--- /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 000000000..0a66a41e0
--- /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 000000000..c960b5fd7
--- /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 000000000..aaf054510
--- /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 000000000..561c26d16
--- /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 000000000..578ebe20b
--- /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 000000000..6df3fd8a8
--- /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 000000000..3970167dc
--- /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 000000000..9599f1d74
--- /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 000000000..7d90786de
--- /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 000000000..b3a41f9f0
--- /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 000000000..0500241bc
--- /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 000000000..0a4a13558
--- /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 000000000..2eeafa747
--- /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 000000000..cdc2f0019
--- /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 000000000..3d204d201
--- /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 000000000..35f95826f
--- /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 000000000..80e3cca65
--- /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 000000000..d76b252f6
--- /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 000000000..bc78722b6
--- /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 000000000..99ff340b4
--- /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 000000000..05ac44dde
--- /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 000000000..f6d34d3c9
--- /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 000000000..545c044e0
--- /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 000000000..77ba145d9
--- /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 000000000..92b86a42a
--- /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 000000000..eecbf1d45
--- /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 000000000..e396a9442
--- /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 000000000..03c536929
--- /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 000000000..9d3c38af1
--- /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 000000000..347529175
--- /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 000000000..d1077d2f0
--- /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 000000000..59068fce6
--- /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 000000000..7585e950f
--- /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 000000000..329d1cd5f
--- /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 000000000..a4ca5977c
--- /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 000000000..56f5e9cbf
--- /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 000000000..c0457ff67
--- /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 000000000..ebfb593d1
--- /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 000000000..7d01dfb3f
--- /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 000000000..bf2535a36
--- /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 000000000..6fa0e76e0
--- /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 000000000..dbea976be
--- /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 000000000..9d48ce5d0
--- /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 000000000..c76b615a1
--- /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 000000000..92d168a89
--- /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 000000000..2916e0187
--- /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 000000000..532e13f69
--- /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 000000000..f839b6bf1
--- /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 000000000..e075ab5f2
--- /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 000000000..cc793c9a1
--- /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 000000000..61a12495a
--- /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 000000000..ec9fa2e8c
--- /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 000000000..5960690bb
--- /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 000000000..43f4d603a
--- /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 000000000..619ac4cba
--- /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 000000000..36af3dc1a
--- /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 000000000..2b885c7b3
--- /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 000000000..9fe2113f1
--- /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 000000000..9da62642c
--- /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 000000000..1ba4fdeea
--- /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 000000000..3eec8ec8a
--- /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 000000000..8247d2fc6
--- /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 000000000..3faa251ea
--- /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 000000000..ae85358b2
--- /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 000000000..8f0334f13
--- /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 000000000..be11da8aa
--- /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 000000000..7f351ac55
--- /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 000000000..3e821ac7f
--- /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 000000000..b5fff0900
--- /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 000000000..dae800833
--- /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 000000000..3cab31d8d
--- /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 000000000..a064e4cff
--- /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 000000000..da67f24ea
--- /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 000000000..7a5ca9ee3
--- /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 000000000..da5d9aff8
--- /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 000000000..f40fdf3c8
--- /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 000000000..d6373f397
--- /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 000000000..d509540c8
--- /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 000000000..cf14b95c9
--- /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 000000000..092b098c1
--- /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 000000000..e4ad0850e
--- /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 000000000..38feff556
--- /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 000000000..5e4a617c0
--- /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 000000000..faf54c275
--- /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 000000000..a9ee0d3dd
--- /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 000000000..27f9d9a14
--- /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 000000000..2979e1c77
--- /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 000000000..b8b0b915d
--- /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 000000000..af72e7a4b
--- /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 000000000..0e54b7403
--- /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 000000000..20d47bbc0
--- /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 000000000..99fb8119a
--- /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 000000000..e4b21432f
--- /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 000000000..0b29d8be1
--- /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 000000000..be9b470e1
--- /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 000000000..055a52d10
--- /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 000000000..6915eeffd
--- /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 000000000..109a308a6
--- /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 000000000..a014f1fbc
--- /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 000000000..7c5b42a1e
--- /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 000000000..975cc5274
--- /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 000000000..da4158765
--- /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 000000000..d9467ffc0
--- /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 000000000..e22ff7484
--- /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 000000000..f4f4a8c4d
--- /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 000000000..584a43b8c
--- /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 000000000..f871ac85d
--- /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 000000000..4a6a00fcc
--- /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 000000000..b39e74e19
--- /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 000000000..3bc2423d0
--- /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 000000000..d027d6e38
--- /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 000000000..571774cea
--- /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 000000000..9fb425376
--- /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 000000000..f2a74c41b
--- /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 000000000..344df7067
--- /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 000000000..06f52a087
--- /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 000000000..4a767a9d6
--- /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 000000000..1eadba121
--- /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 000000000..18ad685e8
--- /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 000000000..282093289
--- /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 000000000..301edc1bd
--- /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 000000000..df5f7d886
--- /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 000000000..e6e8d3b26
--- /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 000000000..72d16f779
--- /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 000000000..e50f4dce7
--- /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 000000000..1ea148733
--- /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 000000000..f93610a50
--- /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 000000000..69c90c2ad
--- /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 000000000..74bc9e5bf
--- /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 000000000..161b4264e
--- /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 000000000..c84981f86
--- /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 000000000..c8e09efef
--- /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 000000000..66fb0fc39
--- /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 000000000..8efbabba8
--- /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 000000000..4bb0465f4
--- /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 000000000..78d8445ce
--- /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 000000000..c44d2a9a8
--- /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 000000000..241740df3
--- /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 000000000..a53e0cab2
--- /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 000000000..187152d5a
--- /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 000000000..73fdaa3a8
--- /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 000000000..cb1c74142
--- /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 000000000..704a4baea
--- /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 000000000..f67477065
--- /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 000000000..0f977f293
--- /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 000000000..60d513ede
--- /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 000000000..2f12bac20
--- /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 000000000..f3a648d68
--- /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 000000000..b1b64db78
--- /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 000000000..56b654d7a
--- /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 000000000..0861258fc
--- /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 000000000..98919e542
--- /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 000000000..12fda8255
--- /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 000000000..94b46e3d1
--- /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 000000000..e74f1547c
--- /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 000000000..369add7bd
--- /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 000000000..354c90cee
--- /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 000000000..37068e9d6
--- /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 000000000..0147f10ec
--- /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 000000000..fbc9383e4
--- /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 000000000..545c5a3bf
--- /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 000000000..384fc3f42
--- /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 000000000..7045d724c
--- /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 000000000..643d39255
--- /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 000000000..ebc2c0402
--- /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 000000000..51ce20e62
--- /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 000000000..c88e2497d
--- /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 000000000..924a3b7a1
--- /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 000000000..d95f9845c
--- /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 000000000..75436630a
--- /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 000000000..81345a94f
--- /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 000000000..6e2d0ac5d
--- /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 000000000..68da44c48
--- /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 000000000..c4cbcf4fb
--- /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 000000000..d4a1fb7ad
--- /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 000000000..769273fd2
--- /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 000000000..bbeb70fc0
--- /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 000000000..b6adb084c
--- /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 000000000..52b287f56
--- /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 000000000..fe5dca94f
--- /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 000000000..5d7895685
--- /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 000000000..50694fc20
--- /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 000000000..a1fae91dc
--- /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 000000000..646f0c0de
--- /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 000000000..f2563cdfa
--- /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 000000000..6abc60f5d
--- /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 000000000..9589ded34
--- /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 000000000..f5e21e3f1
--- /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 000000000..151fcd50c
--- /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 000000000..28b2f7794
--- /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 000000000..fe8373ad8
--- /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 000000000..9e1f95129
--- /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 000000000..1ced2c099
--- /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 000000000..d65deb395
--- /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 000000000..0f37aff79
--- /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 000000000..bc84b775b
--- /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 000000000..dbea6bcf1
--- /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 000000000..12925a90a
--- /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 000000000..23f0f286e
--- /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 000000000..cbe1693e4
--- /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 000000000..5d4a7213f
--- /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 000000000..35dcdd337
--- /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 000000000..c5eb3ac39
--- /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 000000000..f3cef3fec
--- /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 000000000..6dee16398
--- /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 000000000..4fb9f4fda
--- /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 000000000..4c4f3eee0
--- /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 000000000..371b72bc7
--- /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 000000000..57f9cb397
--- /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 000000000..e453aa6d6
--- /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 000000000..4792de072
--- /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 widht 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 000000000..eccc553d5
--- /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 000000000..80f88e512
--- /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 000000000..c02fdbe66
--- /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 000000000..f73724ed5
--- /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 000000000..1d2931778
--- /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 000000000..13f6d5903
--- /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 000000000..536cf8e0c
--- /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 000000000..c0ef4ff6c
--- /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 000000000..e29e05f06
--- /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 000000000..ce452d6b0
--- /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 000000000..2f2739b6e
--- /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 000000000..f0a8ff170
--- /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 000000000..eaac546f8
--- /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 000000000..1ca95e522
--- /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 000000000..aca8fe3cc
--- /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 000000000..a009cf904
--- /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 000000000..f1dc5e2c3
--- /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 000000000..a5bfd416f
--- /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 000000000..d5b9c605e
--- /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 000000000..45e90fe10
--- /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 000000000..e85f2aced
--- /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 000000000..4ddfab2f7
--- /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 000000000..2e27c7dc7
--- /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 000000000..0d85407a6
--- /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 000000000..8d82008f8
--- /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 000000000..692da1686
--- /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 000000000..01fd99e8a
--- /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 000000000..c08d93674
--- /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 000000000..5796b4878
--- /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 000000000..a75905509
--- /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 000000000..46922420f
--- /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 000000000..d3638d4d0
--- /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 000000000..b41c12c6b
--- /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 000000000..3c47050e9
--- /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 000000000..ba01514f7
--- /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 000000000..c79cac194
--- /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 000000000..5a65288e1
--- /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 000000000..a22a8f698
--- /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 000000000..806a0b454
--- /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 000000000..7a18ed3b8
--- /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 000000000..d26872b8f
--- /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 000000000..43e488f37
--- /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 000000000..45613a60f
--- /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 000000000..db02ff8e4
--- /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 000000000..5d509e498
--- /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 000000000..a36529b3e
--- /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 000000000..9609977cb
--- /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 000000000..6fad56b2f
--- /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 000000000..3c2d78628
--- /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 000000000..ca1d52fc0
--- /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 000000000..3fed838e6
--- /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 000000000..6300196dd
--- /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 000000000..a81c6bca8
--- /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 000000000..bf90e3aa1
--- /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 000000000..0bcaef7c5
--- /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 000000000..05d58530e
--- /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 000000000..268628c7f
--- /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 000000000..875bed598
--- /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 000000000..7594a3bb7
--- /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 000000000..803b7953d
--- /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 000000000..7e79e15d1
--- /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 000000000..cf63a9f0c
--- /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 000000000..ada148e6d
--- /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 000000000..f829270ce
--- /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 000000000..8090af6a9
--- /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 000000000..c5839fcfa
--- /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 000000000..ea8b546d8
--- /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 000000000..328319679
--- /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 000000000..d7d0299df
--- /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 000000000..2d3836e30
--- /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 000000000..085162e8a
--- /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 000000000..1c14c4efe
--- /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 000000000..6ba550abc
--- /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 000000000..ae0f5cc06
--- /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 000000000..f4f4ecacb
--- /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 000000000..0a4bc172a
--- /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 000000000..2bc873318
--- /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 000000000..bca537692
--- /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 000000000..56ff76430
--- /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 000000000..d8ef6e2c7
--- /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 000000000..8e1f04a6b
--- /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 000000000..032bdb487
--- /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 000000000..f2ebe3090
--- /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 000000000..7b7283919
--- /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 000000000..89bee078a
--- /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 000000000..96e0286ba
--- /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 000000000..278bb4d8f
--- /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 000000000..935cb0300
--- /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 000000000..67d5ac17b
--- /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 000000000..8e61c5659
--- /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 000000000..7d13255cd
--- /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 000000000..249c18aba
--- /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 000000000..639ff2218
--- /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 000000000..fb390e296
--- /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 000000000..7c885c712
--- /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 000000000..1031269e7
--- /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 000000000..b32dec2f7
--- /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 000000000..4d1f179ae
--- /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 000000000..4eae8b05c
--- /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 000000000..d01796423
--- /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 000000000..22d5db003
--- /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 000000000..834a3c4f3
--- /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 000000000..917fc4f83
--- /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 000000000..e6795a2ec
--- /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 000000000..b1e692809
--- /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 000000000..45d6f725b
--- /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 000000000..737760b5b
--- /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 000000000..c485b5f79
--- /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 000000000..090fb95a7
--- /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 000000000..1ab84ef4b
--- /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 000000000..9c5294b9b
--- /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 000000000..1d0dbf023
--- /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 000000000..f4e07af38
--- /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 000000000..685a037ca
--- /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 000000000..7f3f16605
--- /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 000000000..8a888ce49
--- /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 000000000..9ddb9ee6b
--- /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 000000000..4d2ec3187
--- /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 000000000..98c07400f
--- /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 000000000..d78abe3fa
--- /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 000000000..d8d352c14
--- /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 000000000..4863f471f
--- /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 000000000..3a971c920
--- /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 000000000..b07067993
--- /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 000000000..08dcfb0cc
--- /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 000000000..773d84d63
--- /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 000000000..68c78c138
--- /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 000000000..c63ba0fae
--- /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 000000000..8d1b2f760
--- /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 000000000..872086b3e
--- /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 000000000..afb9bd3f7
--- /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 000000000..47825f49b
--- /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 000000000..572d2b963
--- /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 000000000..ba1042456
--- /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 000000000..a10acbf56
--- /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 000000000..234280236
--- /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 000000000..773012256
--- /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 000000000..c87461a1a
--- /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 000000000..5b0c03ee2
--- /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 000000000..68807e72a
--- /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 000000000..33a09d04c
--- /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 000000000..5be023fca
--- /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 000000000..7dc54e90e
--- /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 000000000..5dd3835ae
--- /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 000000000..6d6138c77
--- /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 000000000..5368c9788
--- /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 000000000..b418ededb
--- /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 000000000..e43e8e823
--- /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 000000000..b1a942ca5
--- /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 000000000..8cd5111f8
--- /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 000000000..896786dfb
--- /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 000000000..0b7db508f
--- /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 000000000..61fabe630
--- /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 000000000..f2b334400
--- /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 000000000..236493286
--- /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 000000000..d97296143
--- /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 000000000..94e1b4cb2
--- /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 000000000..00cde3b3a
--- /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 000000000..4a41966ed
--- /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 000000000..31c48480a
--- /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 000000000..0ad342c73
--- /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 000000000..851c288de
--- /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 000000000..8e4cd60f9
--- /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 000000000..9cbaee53f
--- /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 000000000..c938cb012
--- /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 000000000..3f208f88a
--- /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 000000000..56f71638a
--- /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 000000000..4faad2ce5
--- /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 000000000..3cf3ed281
--- /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 000000000..fc63764ef
--- /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 000000000..9321704af
--- /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 000000000..ec7bb985f
--- /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 000000000..6d277d373
--- /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 000000000..672b3f203
--- /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 000000000..65e859bd0
--- /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 000000000..e0cbd5d1d
--- /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 000000000..c55881bfc
--- /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 000000000..787e25b04
--- /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 000000000..b0fb6a4bf
--- /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 000000000..a185d0aea
--- /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 000000000..110bfacf5
--- /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 000000000..c7f63a5b2
--- /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 000000000..6adfbdc0f
--- /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 000000000..20db3cd3d
--- /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 000000000..756fa15fb
--- /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 000000000..a42b1adea
--- /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 000000000..e14140aa1
--- /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 000000000..ea72e4f4c
--- /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 000000000..71955d803
--- /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 000000000..464e10219
--- /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 000000000..7845ad66f
--- /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 000000000..51cb27c42
--- /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 000000000..b4fffa75b
--- /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 000000000..cdc90cd89
--- /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 000000000..4992bf58f
--- /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 000000000..b75311295
--- /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 000000000..08d024c80
--- /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 000000000..18e65d292
--- /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 000000000..fc6c22bdb
--- /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 000000000..b83549acb
--- /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 000000000..6937d9840
--- /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 000000000..ecf41f818
--- /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 000000000..aee22a0d7
--- /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 000000000..8339ee5c7
--- /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 000000000..2790c58f3
--- /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 000000000..e43feb2d0
--- /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 000000000..dd0a7504e
--- /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 000000000..af9f31a9e
--- /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 000000000..13c9df10e
--- /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 000000000..08d3f8267
--- /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 000000000..4acdbf740
--- /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 000000000..3049fd2d1
--- /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 000000000..ae49b1668
--- /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 000000000..615758b6d
--- /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 000000000..e15e92d01
--- /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 000000000..e747e5504
--- /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 000000000..4c0f067b0
--- /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 000000000..9f3684e80
--- /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 000000000..d1d32f2af
--- /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 000000000..548028cd6
--- /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 000000000..879b6208e
--- /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 000000000..f71ce5975
--- /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 000000000..a3913a0e2
--- /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 000000000..0ab6be828
--- /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 000000000..2ad21a3fc
--- /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 000000000..60bc37a43
--- /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 000000000..90a5f26f4
--- /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 000000000..764561b85
--- /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 000000000..8f6fdf5df
--- /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 000000000..d62a04253
--- /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 000000000..1be5b3943
--- /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 000000000..6d86909f6
--- /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 000000000..fb9db8319
--- /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 000000000..98dd3e521
--- /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 000000000..0c91403e0
--- /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 000000000..417329e47
--- /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 000000000..cd3bb8f8c
--- /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 000000000..a4cae627d
--- /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 000000000..3e81c1002
--- /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 000000000..b34171f23
--- /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 000000000..2d6b6d7db
--- /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 000000000..8d11cd16e
--- /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 000000000..aaae8e692
--- /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 000000000..a7a48caa4
--- /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 000000000..4917f7f78
--- /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 000000000..3e756c4ec
--- /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 000000000..8e2a0c0eb
--- /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 000000000..fa936ddb0
--- /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 000000000..6a58ca281
--- /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 000000000..25a0cfd8f
--- /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 000000000..773b999aa
--- /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 000000000..e765457cf
--- /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 000000000..596d8e3ff
--- /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 000000000..e3bea1571
--- /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 000000000..4cc91da2d
--- /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 000000000..f3523bcf3
--- /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 000000000..0749cf7b4
--- /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 000000000..02638b839
--- /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 000000000..ba9c06512
--- /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 000000000..74698fa28
--- /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 000000000..f9196d7ef
--- /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 000000000..8f969113f
--- /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 000000000..c22a7f699
--- /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 000000000..a50bba9e5
--- /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 000000000..961727335
--- /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 000000000..93b5a7937
--- /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 000000000..888a48e12
--- /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 000000000..0e3bb673e
--- /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 000000000..bbc83b2d8
--- /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 000000000..a9e34590c
--- /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 000000000..f7ad75f43
--- /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 000000000..464b901b2
--- /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 000000000..d0d9bff3a
--- /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 000000000..e81ac9e40
--- /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 000000000..9d13c8481
--- /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 000000000..1812d575f
--- /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 000000000..63981731d
--- /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 000000000..862d52b08
--- /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 000000000..ee40383e1
--- /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 000000000..0fb4d5615
--- /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 000000000..43d735d1d
--- /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 000000000..70b1973ba
--- /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 000000000..0ee499ec4
--- /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 000000000..47bc00800
--- /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 000000000..8b7a7885d
--- /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 000000000..691659797
--- /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 000000000..6397a803a
--- /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 000000000..107f65221
--- /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 000000000..aa9b94df7
--- /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 000000000..ccb05c251
--- /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 000000000..719ffa42c
--- /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 000000000..b3ba2a4cd
--- /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 000000000..20dd16e84
--- /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 000000000..4384ea0cf
--- /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 000000000..9c3f26440
--- /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 000000000..23ca0f415
--- /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 000000000..941683d8f
--- /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 000000000..b62ed8375
--- /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 000000000..fecd64ea7
--- /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 000000000..ac1370db8
--- /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 000000000..2808b6ffa
--- /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 000000000..0e44add03
--- /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 000000000..7bd7104fb
--- /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 000000000..4ef3a6cde
--- /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 000000000..c834b83b4
--- /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 000000000..4c41700ab
--- /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 000000000..b4cc70d7a
--- /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 000000000..ef7b8352b
--- /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 000000000..46b1f81d7
--- /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 000000000..9c2ee518b
--- /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 000000000..1fadc4b91
--- /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 000000000..3d0e51e1d
--- /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 000000000..42a24f385
--- /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 000000000..095ff6f19
--- /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 000000000..f8724c73b
--- /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 000000000..5442287b1
--- /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_temporaryFileBlob.js b/dom/tests/mochitest/fetch/common_temporaryFileBlob.js
new file mode 100644
index 000000000..47f5695b1
--- /dev/null
+++ b/dom/tests/mochitest/fetch/common_temporaryFileBlob.js
@@ -0,0 +1,39 @@
+var data = new Array(256).join("1234567890ABCDEF");
+
+function test_basic() {
+ info("Simple 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");
+
+ var fr = new FileReader();
+ fr.readAsText(blob);
+ fr.onload = function() {
+ is(fr.result, data, "Data content matches");
+ next();
+ }
+ });
+}
+
+function test_worker() {
+ info("XHR in workers");
+ 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(42);
+}
diff --git a/dom/tests/mochitest/fetch/empty.js b/dom/tests/mochitest/fetch/empty.js
new file mode 100644
index 000000000..e69de29bb
--- /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 000000000..d0b9633bb
--- /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 000000000..8ded0911f
--- /dev/null
+++ b/dom/tests/mochitest/fetch/fetch_test_framework.js
@@ -0,0 +1,165 @@
+function testScript(script) {
+
+ // 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(2);
+
+ // 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.requestcontext.enabled", true],
+ ["dom.serviceWorkers.enabled", true],
+ ["dom.serviceWorkers.testing.enabled", true],
+ ["dom.serviceWorkers.exemptFromPerDomainMax", true]]
+ }, resolve);
+ });
+ }
+
+ function workerTest() {
+ return new Promise(function(resolve, reject) {
+ var worker = new Worker("worker_wrapper.js");
+ 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": script });
+ });
+ }
+
+ function nestedWorkerTest() {
+ return new Promise(function(resolve, reject) {
+ var worker = new Worker("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": 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.waiting ||
+ registration.active;
+
+ window.addEventListener("message",function onMessage(event) {
+ if (event.data.context != "ServiceWorker") {
+ return;
+ }
+ if (event.data.type == 'finish') {
+ window.removeEventListener("message", onMessage);
+ registration.unregister()
+ .then(resolve)
+ .catch(reject);
+ } else if (event.data.type == 'status') {
+ ok(event.data.status, event.data.context + ": " + event.data.msg);
+ }
+ }, false);
+
+ worker.onerror = reject;
+
+ var iframe = document.createElement("iframe");
+ iframe.src = "message_receiver.html";
+ iframe.onload = function() {
+ worker.postMessage({ script: script });
+ };
+ document.body.appendChild(iframe);
+ }
+
+ navigator.serviceWorker.register("worker_wrapper.js", {scope: "."})
+ .then(function(registration) {
+ if (registration.installing) {
+ var done = false;
+ registration.installing.onstatechange = function() {
+ if (!done) {
+ done = true;
+ setupSW(registration);
+ }
+ };
+ } else {
+ setupSW(registration);
+ }
+ });
+ });
+ }
+
+ 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() {
+ // XXX Bug 1281212 - This makes other, unrelated test suites fail, primarily on WinXP.
+ let isWin = navigator.platform.indexOf("Win") == 0;
+ return isWin ? undefined : 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() {
+ if (parent && parent.finishTest) {
+ parent.finishTest();
+ } else {
+ SimpleTest.finish();
+ }
+ });
+}
+
diff --git a/dom/tests/mochitest/fetch/message_receiver.html b/dom/tests/mochitest/fetch/message_receiver.html
new file mode 100644
index 000000000..82cb587c7
--- /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 000000000..cf4477463
--- /dev/null
+++ b/dom/tests/mochitest/fetch/mochitest.ini
@@ -0,0 +1,57 @@
+[DEFAULT]
+support-files =
+ fetch_test_framework.js
+ test_fetch_basic.js
+ test_fetch_basic_http.js
+ test_fetch_cors.js
+ 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^
+ sw_reroute.js
+ empty.js
+ empty.js^headers^
+ worker_temporaryFileBlob.js
+ common_temporaryFileBlob.js
+ !/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
+
+[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_cors.html]
+skip-if = toolkit == 'android' # Bug 1210282
+[test_fetch_cors_sw_reroute.html]
+skip-if = toolkit == 'android' # Bug 1210282
+[test_fetch_cors_sw_empty_reroute.html]
+skip-if = toolkit == 'android' # Bug 1210282
+[test_formdataparsing.html]
+[test_formdataparsing_sw_reroute.html]
+[test_request.html]
+[test_request_context.html]
+[test_request_sw_reroute.html]
+[test_response.html]
+[test_response_sw_reroute.html]
+[test_temporaryFileBlob.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 000000000..7e463e7df
--- /dev/null
+++ b/dom/tests/mochitest/fetch/nested_worker_wrapper.js
@@ -0,0 +1,28 @@
+// 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');
+
+ 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 000000000..bb12212ea
--- /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 000000000..2c9bcd35f
--- /dev/null
+++ b/dom/tests/mochitest/fetch/reroute.js
@@ -0,0 +1,24 @@
+onfetch = function(e) {
+ if (e.request.url.indexOf("Referer") >= 0) {
+ // 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=' + ({ 'Referer': self.location.href }).toSource();
+
+ 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: body,
+ mode: 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 000000000..d0b9633bb
--- /dev/null
+++ b/dom/tests/mochitest/fetch/reroute.js^headers^
@@ -0,0 +1 @@
+Service-Worker-Allowed: /
diff --git a/dom/tests/mochitest/fetch/sw_reroute.js b/dom/tests/mochitest/fetch/sw_reroute.js
new file mode 100644
index 000000000..11ad7b76e
--- /dev/null
+++ b/dom/tests/mochitest/fetch/sw_reroute.js
@@ -0,0 +1,31 @@
+var gRegistration;
+
+function testScript(script) {
+ function setupSW(registration) {
+ gRegistration = registration;
+
+ var iframe = document.createElement("iframe");
+ iframe.src = "reroute.html?" + script.replace(".js", "");
+ document.body.appendChild(iframe);
+ }
+
+ SpecialPowers.pushPrefEnv({
+ "set": [["dom.serviceWorkers.enabled", true],
+ ["dom.serviceWorkers.testing.enabled", true],
+ ["dom.serviceWorkers.exemptFromPerDomainMax", true]]
+ }, function() {
+ navigator.serviceWorker.ready.then(setupSW);
+ var scriptURL = location.href.includes("sw_empty_reroute.html")
+ ? "empty.js" : "reroute.js";
+ navigator.serviceWorker.register(scriptURL, {scope: "/"});
+ });
+}
+
+function finishTest() {
+ 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 000000000..ce7b63aba
--- /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 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>
+<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 000000000..16ce9d8a3
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic.js
@@ -0,0 +1,104 @@
+function testAboutURL() {
+ var p1 = fetch('about:blank').then(function(res) {
+ is(res.status, 200, "about:blank should load a valid Response");
+ is(res.headers.get('content-type'), 'text/html;charset=utf-8',
+ "about:blank content-type should be text/html;charset=utf-8");
+ is(res.headers.has('content-length'), false,
+ "about:blank should not have a content-length header");
+ return res.text().then(function(v) {
+ is(v, "", "about:blank body should be empty");
+ });
+ });
+
+ 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: 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 runTest() {
+ return Promise.resolve()
+ .then(testAboutURL)
+ .then(testDataURL)
+ .then(testSameOriginBlobURL)
+ .then(testNonGetBlobURL)
+ // 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 000000000..24175bb19
--- /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 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>
+<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 000000000..4cd326ea8
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http.js
@@ -0,0 +1,201 @@
+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]);
+ // This file redirects to pass2, but that is invisible if a SW is present.
+ if (entry[0] != "file_XHR_pass3.txt" || isSWPresent)
+ 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]);
+ // This file redirects to pass2, but that is invisible if a SW is present.
+ if (entry[0] != "file_XHR_pass3.txt" || isSWPresent)
+ 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) => {
+ ok(r.status, 200, "status should match");
+ return r.blob().then((b) => {
+ ok(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) => {
+ ok(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 000000000..0f5052eda
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_empty_reroute.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 1039846 - Test fetch() http fetching in worker</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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 000000000..0f5052eda
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http_sw_reroute.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 1039846 - Test fetch() http fetching in worker</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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 000000000..bcf959add
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_sw_empty_reroute.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 1039846 - Test fetch() function in worker</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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 000000000..bcf959add
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_sw_reroute.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 1039846 - Test fetch() function in worker</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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_cors.html b/dom/tests/mochitest/fetch/test_fetch_cors.html
new file mode 100644
index 000000000..b9a6992a5
--- /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 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>
+<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 000000000..ac83d050d
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cors.js
@@ -0,0 +1,1748 @@
+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 "omit".
+ pass: 1,
+ noCookie: 1,
+ },
+ {
+ 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 " + test.toSource());
+ is(res.status, 200, "wrong status in test for " + test.toSource());
+ is(res.statusText, "OK", "wrong status text for " + test.toSource());
+ return res.text().then(function(v) {
+ is(v, "<res>hello pass</res>\n",
+ "wrong text in test for " + test.toSource());
+ });
+ }
+
+ 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 " + test.toSource());
+ ok(e instanceof TypeError, "Test should fail " + test.toSource());
+ 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
+ // XXXbz this passes for now, because we ignore passwords
+ // without usernames in most cases.
+ { pass: 1,
+ 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"]
+ .indexOf(test.headers[name].toLowerCase()) == -1);
+ }
+ req.url += "&headers=" + escape(test.headers.toSource());
+ reqHeaders =
+ escape(Object.keys(test.headers)
+ .filter(isUnsafeHeader)
+ .map(String.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(test.responseHeaders.toSource());
+ 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 " + test.toSource());
+ if (test.status) {
+ is(res.status, test.status, "wrong status in test for " + test.toSource());
+ is(res.statusText, test.statusMessage, "wrong status text for " + test.toSource());
+ }
+ else {
+ is(res.status, 200, "wrong status in test for " + test.toSource());
+ is(res.statusText, "OK", "wrong status text for " + test.toSource());
+ }
+ if (test.responseHeaders) {
+ for (header in test.responseHeaders) {
+ if (test.expectedResponseHeaders.indexOf(header) == -1) {
+ is(res.headers.has(header), false,
+ "|Headers.has()|wrong response header (" + header + ") in test for " +
+ test.toSource());
+ }
+ else {
+ is(res.headers.get(header), test.responseHeaders[header],
+ "|Headers.get()|wrong response header (" + header + ") in test for " +
+ test.toSource());
+ }
+ }
+ }
+
+ return res.text();
+ }).then(function(v) {
+ if (test.method !== "HEAD") {
+ is(v, "<res>hello pass</res>\n",
+ "wrong responseText in test for " + test.toSource());
+ }
+ else {
+ is(v, "",
+ "wrong responseText in HEAD test for " + test.toSource());
+ }
+ }).catch(function(e) {
+ ok(!test.pass, "Expected test failure for " + test.toSource());
+ ok(e instanceof TypeError, "Exception should be TypeError for " + test.toSource());
+ });
+ })(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(test.hops.toSource());
+ } else {
+ url = baseURL + "allowOrigin=" + escape(test.origin || origin);
+ }
+ req = {
+ url: 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 " + test.toSource());
+ is(res.status, 200, "wrong status in test for " + test.toSource());
+ is(res.statusText, "OK", "wrong status text for " + test.toSource());
+ return res.text().then(function(v) {
+ is(v, "<res>hello pass</res>\n",
+ "wrong text in test for " + test.toSource());
+ });
+ }
+
+ 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 " + test.toSource());
+ ok(e instanceof TypeError, "Exception should be TypeError for " + test.toSource());
+ 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 ' + test.toSource());
+
+ // 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 " + test.toSource());
+ return unfiltered.text().then(function(v) {
+ if (status === 200) {
+ is(v, "<res>hello pass</res>\n",
+ "wrong text in test for " + test.toSource());
+ }
+ });
+ }
+
+ function runATest(tests, i) {
+ if (typeof SpecialPowers !== 'object') {
+ finalPromiseResolve();
+ return;
+ }
+
+ 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 to fail " + test.toSource());
+ ok(e instanceof TypeError, "Test should fail " + test.toSource());
+ 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(test.hops.toSource()),
+ method: test.method,
+ headers: test.headers,
+ body: test.body,
+ };
+
+ if (test.headers) {
+ req.url += "&headers=" + escape(test.headers.toSource());
+ }
+
+ 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 " + test.toSource());
+ is(res.status, 200, "wrong status in test for " + test.toSource());
+ is(res.statusText, "OK", "wrong status text for " + test.toSource());
+ is(res.type, 'cors', 'wrong response type for ' + test.toSource());
+ 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 " + test.toSource());
+ });
+ }, function(e) {
+ ok(!test.pass, "Expected test failure for " + test.toSource());
+ ok(e instanceof TypeError, "Exception should be TypeError for " + test.toSource());
+ });
+ })(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(test.hops.toSource()),
+ method: test.method,
+ headers: test.headers,
+ body: test.body,
+ };
+
+ if (test.headers) {
+ req.url += "&headers=" + escape(test.headers.toSource());
+ }
+
+ 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 " + test.toSource());
+ // 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 ' + test.toSource());
+ is(res.status, 0, "wrong status in test for " + test.toSource());
+ is(res.statusText, "", "wrong status text for " + test.toSource());
+ is(res.url, '', 'wrong response url for ' + test.toSource());
+ return res.text().then(function(v) {
+ is(v, "", "wrong responseText in test for " + test.toSource());
+ });
+ }, function(e) {
+ ok(!test.pass, "Expected test failure for " + test.toSource());
+ ok(e instanceof TypeError, "Exception should be TypeError for " + test.toSource());
+ });
+ })(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=" + dict.toSource()).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();
+
+ return Promise.resolve()
+ .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 000000000..7ad368cfd
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cors_sw_empty_reroute.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 1039846 - Test fetch() CORS mode</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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 000000000..7ad368cfd
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_fetch_cors_sw_reroute.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 1039846 - Test fetch() CORS mode</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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_formdataparsing.html b/dom/tests/mochitest/fetch/test_formdataparsing.html
new file mode 100644
index 000000000..ca81311fd
--- /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 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>
+<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 000000000..bc7eb21a6
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_formdataparsing.js
@@ -0,0 +1,283 @@
+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: 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 000000000..b3fe0db44
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_formdataparsing_sw_reroute.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 1109751 - Test FormData parsing</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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 000000000..f13f53425
--- /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 type="text/javascript" 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 000000000..fe792b25b
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_headers_common.js
@@ -0,0 +1,229 @@
+//
+// 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");
+
+ 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, "bam\n");
+ }, TypeError, "Append invalid header value should throw TypeError.");
+
+ shouldThrow(function() {
+ headers.append(name, "bam\n\r");
+ }, 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("utf-8");
+ 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", "foo", "foo2"], "Correct key iterator");
+ arrayEquals(iterate(value_iter), ["bar", ehsanInflated, "baz2"], "Correct value iterator");
+ arrayEquals(iterate(entries_iter), [["foo", "bar"], ["foo", ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
+
+ arrayEquals(iterateForOf(headers), [["foo", "bar"], ["foo", ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
+ arrayEquals(iterateForOf(new Headers(headers)), [["foo", "bar"], ["foo", 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 000000000..9bdc89b71
--- /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 type="text/javascript" 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 000000000..dd6ec5fb3
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_headers_sw_reroute.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>Test Fetch Headers - Basic</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<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_request.html b/dom/tests/mochitest/fetch/test_request.html
new file mode 100644
index 000000000..83869fd11
--- /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 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>
+<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 000000000..badad61b9
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_request.js
@@ -0,0 +1,542 @@
+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.context, "fetch", "Default context is fetch.");
+ 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, "omit", "Default Request credentials is omit");
+ 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.context, "fetch", "Default context is fetch.");
+ 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, "omit", "Default Request credentials is omit");
+ 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: 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: 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");
+ ok(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: 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: 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 000000000..07c99e2f0
--- /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 type="text/javascript" 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 000000000..9fbfe767c
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_request_sw_reroute.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 Request object in worker</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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 000000000..648851e8b
--- /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 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>
+<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 000000000..e396184ee
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_response.js
@@ -0,0 +1,267 @@
+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, "OK", "Default statusText is OK");
+}
+
+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");
+ 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": 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": 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_response_sw_reroute.html b/dom/tests/mochitest/fetch/test_response_sw_reroute.html
new file mode 100644
index 000000000..9f9751b8a
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_response_sw_reroute.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 1039846 - Test Response object in worker</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>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<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 000000000..f7390f9d2
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_temporaryFileBlob.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1312410</title>
+ <script type="application/javascript" 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_basic,
+ test_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/utils.js b/dom/tests/mochitest/fetch/utils.js
new file mode 100644
index 000000000..5d294041e
--- /dev/null
+++ b/dom/tests/mochitest/fetch/utils.js
@@ -0,0 +1,37 @@
+// 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));
+ }
+}
+
diff --git a/dom/tests/mochitest/fetch/worker_temporaryFileBlob.js b/dom/tests/mochitest/fetch/worker_temporaryFileBlob.js
new file mode 100644
index 000000000..182dc7c18
--- /dev/null
+++ b/dom/tests/mochitest/fetch/worker_temporaryFileBlob.js
@@ -0,0 +1,21 @@
+importScripts('common_temporaryFileBlob.js');
+
+function info(msg) {
+ postMessage({type: 'info', msg: msg});
+}
+
+function ok(a, msg) {
+ postMessage({type: 'check', what: !!a, msg: msg});
+}
+
+function is(a, b, msg) {
+ ok(a === b, msg);
+}
+
+function next() {
+ postMessage({type: 'finish'});
+}
+
+onmessage = function(e) {
+ test_basic();
+}
diff --git a/dom/tests/mochitest/fetch/worker_wrapper.js b/dom/tests/mochitest/fetch/worker_wrapper.js
new file mode 100644
index 000000000..c2f0ec00e
--- /dev/null
+++ b/dom/tests/mochitest/fetch/worker_wrapper.js
@@ -0,0 +1,58 @@
+importScripts("utils.js");
+var client;
+var context;
+
+function ok(a, msg) {
+ client.postMessage({type: 'status', status: !!a,
+ msg: a + ": " + msg, context: context});
+}
+
+function is(a, b, msg) {
+ client.postMessage({type: 'status', status: a === b,
+ msg: a + " === " + b + ": " + msg, context: context});
+}
+
+addEventListener('message', function workerWrapperOnMessage(e) {
+ removeEventListener('message', workerWrapperOnMessage);
+ var data = e.data;
+
+ function loadTest() {
+ var done = function() {
+ client.postMessage({ type: 'finish', context: context });
+ }
+
+ try {
+ importScripts(data.script);
+ // runTest() is provided by the test.
+ runTest().then(done, done);
+ } catch(e) {
+ client.postMessage({
+ type: 'status',
+ status: false,
+ msg: 'worker failed to import ' + data.script + "; error: " + e.message,
+ context: context
+ });
+ done();
+ }
+ }
+
+ if ("ServiceWorker" in self) {
+ self.clients.matchAll().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";
+ loadTest();
+ });
+ } else {
+ client = self;
+ context = "Worker";
+ loadTest();
+ }
+});
diff --git a/dom/tests/mochitest/gamepad/gamepad_frame.html b/dom/tests/mochitest/gamepad/gamepad_frame.html
new file mode 100644
index 000000000..345fec469
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/gamepad_frame.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>frame</title>
+ <script type="text/javascript">
+ var connectedEvents = 0;
+ var buttonPresses = 0;
+ window.addEventListener("gamepadconnected", function() {
+ connectedEvents++;
+});
+ window.addEventListener("gamepadbuttondown", function() {
+ buttonPresses++;
+});
+ </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 000000000..a53b91b2c
--- /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 000000000..add02cb59
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/mochitest.ini
@@ -0,0 +1,12 @@
+[DEFAULT]
+support-files =
+ gamepad_frame.html
+ gamepad_frame_state.html
+ mock_gamepad.js
+
+[test_check_timestamp.html]
+[test_gamepad.html]
+[test_gamepad_connect_events.html]
+[test_gamepad_frame_state_sync.html]
+[test_gamepad_hidden_frame.html]
+[test_navigator_gamepads.html]
diff --git a/dom/tests/mochitest/gamepad/mock_gamepad.js b/dom/tests/mochitest/gamepad/mock_gamepad.js
new file mode 100644
index 000000000..a24660424
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/mock_gamepad.js
@@ -0,0 +1,12 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+var GamepadService;
+
+function runGamepadTest (callback) {
+ SpecialPowers.pushPrefEnv({"set" : [["dom.gamepad.test.enabled", true]]},
+ () => {
+ GamepadService = navigator.requestGamepadServiceTest();
+ callback();
+ });
+} \ No newline at end of file
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 000000000..fa167d57b
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_check_timestamp.html
@@ -0,0 +1,65 @@
+<!-- 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 type="text/javascript" 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">
+
+window.addEventListener("gamepadbuttondown", buttonpresshandler);
+
+var index;
+var timea=0;
+var firstPress = true;
+var testOver = false;
+
+SimpleTest.waitForExplicitFinish();
+runGamepadTest(checkTimestamp);
+
+function checkTimestamp(){
+ GamepadService.addGamepad("test gamepad 1",
+ GamepadService.standardMapping,
+ 4,
+ 2).then(function(i) {
+ index = i;
+ // Press a button to make the gamepad visible
+ // to the page.
+ GamepadService.newButtonEvent(index, 0, true);
+ GamepadService.newButtonEvent(index, 0, true);
+ ok(true, "test");
+ });
+}
+
+function cleanup(){
+ SpecialPowers.executeSoon(function() {
+ GamepadService.removeGamepad(index);
+ SimpleTest.finish();
+ });
+}
+
+function buttonpresshandler(e) {
+ if (testOver) {
+ return;
+ }
+ if (timea == 0){
+ timea = e.gamepad.timestamp;
+ } else {
+ ok(timea <= e.gamepad.timestamp, "Timestamp less than last timestamp");
+ }
+ GamepadService.newButtonEvent(index, 0, 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 000000000..e66f7ff2a
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad.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</title>
+ <script type="text/javascript" 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">
+SimpleTest.waitForExplicitFinish();
+// 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);
+
+function startTest() {
+ // Add a gamepad
+ GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ 4,
+ 2).then(function(i) {
+ index = i;
+ // Simulate button events on the gamepad we added
+ GamepadService.newButtonEvent(index, 0, 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");
+}
+
+function buttontest1() {
+ var gamepads = navigator.getGamepads();
+ is(gamepads[0].buttons[0].pressed, true, "gamepad button should register as pressed");
+ GamepadService.newButtonValueEvent(index, 1, true, 0.5);
+}
+
+function buttontest2() {
+ var gamepads = navigator.getGamepads();
+ is(gamepads[0].buttons[1].pressed, true, "gamepad button should register as pressed");
+ is(gamepads[0].buttons[1].value, 0.5, "gamepad button value should be 0.5");
+ GamepadService.removeGamepad(index);
+ SimpleTest.finish();
+}
+
+</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 000000000..e8102c24f
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_connect_events.html
@@ -0,0 +1,76 @@
+<!-- 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 type="text/javascript" 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">
+SimpleTest.waitForExplicitFinish();
+
+var gamepad_index;
+
+function pressButton() {
+ GamepadService.newButtonEvent(gamepad_index, 0, true);
+ GamepadService.newButtonEvent(gamepad_index, 0, false);
+}
+
+ // Add a gamepad
+function startTests() {
+ window.addEventListener("gamepadbuttondown", function() {
+ // Wait to ensure that all frames received the button press as well.
+ SpecialPowers.executeSoon(tests[testNum++]);
+ });
+
+ GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ 4, // buttons
+ 2).then(function(i) {
+ gamepad_index = i;
+ gamepad_connected()
+ });
+}
+
+var f1, f2;
+function gamepad_connected() {
+ f1 = document.getElementById('f1');
+ 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", function() {
+ // When the frame is loaded, press a button again.
+ pressButton();
+ });
+ f2.src = "gamepad_frame.html";
+ document.body.appendChild(f2);
+}
+
+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");
+ 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_frame_state_sync.html b/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html
new file mode 100644
index 000000000..abf721789
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_frame_state_sync.html
@@ -0,0 +1,102 @@
+<!-- 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 type="text/javascript" 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">
+SimpleTest.waitForExplicitFinish();
+ // Add a gamepad
+var index;
+
+function setFrameVisible(f, visible) {
+ var Ci = SpecialPowers.Ci;
+ var docshell = SpecialPowers.wrap(f.contentWindow).QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell);
+ docshell.isActive = visible;
+}
+
+var frames_loaded = 0;
+function startTest() {
+ frames_loaded++;
+ if (frames_loaded == 2) {
+ GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ 4, // buttons
+ 2).then(function(i) {
+ index = i;
+ gamepad_loaded();
+ });
+ }
+}
+var f1, f2;
+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");
+ });
+ w2.addEventListener("gamepadbuttonup", () => {
+ ok(!f2.contentWindow.gamepad.buttons[0].pressed,
+ "frame 2 no button pressed");
+ setFrameVisible(f2, false);
+ SpecialPowers.executeSoon(function() {
+ GamepadService.newButtonEvent(index, 0, true);
+ });
+ })
+ // Now press the button, but don't release it.
+ GamepadService.newButtonEvent(index, 0, 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,
+];
+
+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(f2.contentWindow.gamepad.buttons[0].pressed, "frame 2 sees button pressed");
+
+ // Now release the button, then hide the second frame.
+ GamepadService.newButtonEvent(index, 0, false);
+}
+
+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(!f2.contentWindow.gamepad.buttons[0].pressed, "frame 2 should not see button pressed");
+
+ // Now unhide the second frame.
+ setFrameVisible(f2, true);
+ SpecialPowers.executeSoon(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");
+ // cleanup
+ 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 000000000..d287a128d
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html
@@ -0,0 +1,79 @@
+<!-- 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 type="text/javascript" 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">
+SimpleTest.waitForExplicitFinish();
+
+window.addEventListener("gamepadbuttondown", function() {
+ // Wait to ensure that all frames received the button press as well.
+ SpecialPowers.executeSoon(tests[testNum++]);
+});
+
+function pressButton() {
+ GamepadService.newButtonEvent(index, 0, true);
+ GamepadService.newButtonEvent(index, 0, false);
+}
+
+function setFrameVisible(f, visible) {
+ var Ci = SpecialPowers.Ci;
+ var docshell = SpecialPowers.wrap(f.contentWindow).QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell);
+ docshell.isActive = visible;
+}
+
+var frames_loaded = 0;
+function startTest() {
+ frames_loaded++;
+ if (frames_loaded == 2) {
+ GamepadService.addGamepad("test gamepad", // id
+ GamepadService.standardMapping,
+ 4, // buttons
+ 2).then(function(i) {
+ index = i;
+ gamepad_loaded();
+ });
+ }
+}
+var f1, f2;
+function gamepad_loaded() {
+ f1 = document.getElementById('f1');
+ f2 = document.getElementById('f2');
+ 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( () => { pressButton(); });
+}
+
+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");
+ 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_navigator_gamepads.html b/dom/tests/mochitest/gamepad/test_navigator_gamepads.html
new file mode 100644
index 000000000..48f78397a
--- /dev/null
+++ b/dom/tests/mochitest/gamepad/test_navigator_gamepads.html
@@ -0,0 +1,111 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test gamepad</title>
+ <script type="text/javascript" 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">
+SimpleTest.waitForExplicitFinish();
+
+var testNum = 0;
+var tests = [
+ check_first_gamepad,
+ check_second_gamepad,
+ check_gamepad_hole,
+ check_no_gamepads,
+];
+
+function run_next_test(event) {
+ SpecialPowers.executeSoon(function() { 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)
+
+function startTest() {
+ // gamepads should be empty first
+ is(navigator.getGamepads().length, 0, "should be zero gamepads exposed");
+ // Add a gamepad
+ GamepadService.addGamepad("test gamepad 1", // id
+ GamepadService.standardMapping,
+ 4, // buttons
+ 2).then(function(index) {
+ internal_index1 = index;
+ // Press a button to make the gamepad visible to the page.
+ GamepadService.newButtonEvent(internal_index1, 0, true);
+ });
+}
+
+var content_index1 = 0;
+var internal_index2;
+var content_index2 = 1;
+
+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.
+ GamepadService.addGamepad("test gamepad 2", // id
+ GamepadService.standardMapping,
+ 4, // buttons
+ 2).then(function(index) {
+ internal_index2 = index;
+ GamepadService.newButtonEvent(internal_index2, 0, true);
+ });
+ ok(true, "Done checking first gamepad");
+}
+
+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.
+ GamepadService.removeGamepad(internal_index1);
+ ok(true, "Done checking second gamepad");
+}
+
+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.
+ 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 000000000..ab65fb7e3
--- /dev/null
+++ b/dom/tests/mochitest/general/497633.html
@@ -0,0 +1,24 @@
+<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 src="data:application/xhtml+xml;charset=utf-8,%3Chtml%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%0A%0A%3Ciframe%2F%3E%0A%3Cframeset%20onblur%3D%22window.frameElement.parentNode.removeChild(window.frameElement)%22%20id%3D%22frame%22%2F%3E%0A%0A%3Cscript%3E%0Afunction%20doe(i)%7B%0Adocument.getElementById('frame').focus()%3B%0Adocument.getElementsByTagName('*')%5B1%5D.focus()%3B%0A%7D%0Atop.opener.SimpleTest.waitForFocus(function%20()%20setTimeout(doe%2C%20100)%2C%20top)%3B%0A%3C%2Fscript%3E%0A%3C%2Fhtml%3E" 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 000000000..b46b49c8c
--- /dev/null
+++ b/dom/tests/mochitest/general/chrome.ini
@@ -0,0 +1,9 @@
+[DEFAULT]
+skip-if = os == 'android'
+
+[test_idleapi_permissions.html]
+[test_innerScreen.xul]
+[test_offsets.css]
+[test_offsets.js]
+[test_offsets.xul]
+[test_spacetopagedown.html]
diff --git a/dom/tests/mochitest/general/fail.png b/dom/tests/mochitest/general/fail.png
new file mode 100644
index 000000000..db812bd7d
--- /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 000000000..9fd28888c
--- /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 000000000..811147d78
--- /dev/null
+++ b/dom/tests/mochitest/general/file_clonewrapper.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+<head>
+<script type="application/javascript">
+
+ function waitForMessage() {
+ return new Promise(function(resolve) {
+ window.addEventListener('message', function l(evt) {
+ window.removeEventListener('message', l);
+ resolve(evt.data);
+ });
+ });
+ }
+
+ // 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 000000000..1959fc4f6
--- /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_frameElementWrapping.html b/dom/tests/mochitest/general/file_frameElementWrapping.html
new file mode 100644
index 000000000..44237f7e0
--- /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_interfaces.xml b/dom/tests/mochitest/general/file_interfaces.xml
new file mode 100644
index 000000000..8b5aa5bfa
--- /dev/null
+++ b/dom/tests/mochitest/general/file_interfaces.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<bindings id="xbltestBindings" xmlns="http://www.mozilla.org/xbl">
+ <binding id="xbltest">
+ <content>PASS</content>
+ <implementation>
+ <constructor>
+ var win = XPCNativeWrapper.unwrap(window);
+ var SpecialPowers = win.SpecialPowers;
+ var is = win.is;
+ var todo_is = win.todo_is;
+ var ok = win.ok;
+ var legacyMozPrefixedInterfaces = win.legacyMozPrefixedInterfaces;
+ var createInterfaceMap = win.createInterfaceMap;
+ eval(win.runTest.toString());
+ runTest(true);
+ win.SimpleTest.finish();
+ </constructor>
+ </implementation>
+ </binding>
+</bindings>
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 000000000..2456c6e68
--- /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 000000000..ee09c2bd1
--- /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_showModalDialog.html b/dom/tests/mochitest/general/file_showModalDialog.html
new file mode 100644
index 000000000..1cae0b1c0
--- /dev/null
+++ b/dom/tests/mochitest/general/file_showModalDialog.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+ function go() {
+ is(SpecialPowers.wrap(window).location.toString(), location.toString(), "sanity");
+ ok("returnValue" in window && "dialogArguments" in window, "We are modal");
+ var iwin = document.getElementById('ifr').contentWindow;
+ is(SpecialPowers.Cu.getClassName(iwin, /* aUnwrap = */ true), "Window", "Descendant frames should not be modal");
+
+ if (location.origin != "http://mochi.test:8888") {
+ is(window.dialogArguments, undefined,
+ "dialogArguments should be undefined cross-origin: " + location.origin);
+ }
+
+ window.returnValue = "rv: " + window.dialogArguments;
+
+ // Allow for testing navigations in series.
+ if (location.search == "") {
+ window.close();
+ } else {
+ var origins = location.search.split('?')[1].split(',');
+ var newsearch = '?' + origins.splice(1).join(',');
+ var newurl = location.toString().replace(location.origin, origins[0])
+ .replace(location.search, newsearch);
+ location = newurl;
+ }
+
+ }
+</script>
+</head>
+<body onload="opener.postMessage('dosetup', '*');">
+<iframe id="ifr"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/frameSelectEvents.html b/dom/tests/mochitest/general/frameSelectEvents.html
new file mode 100644
index 000000000..c53bdb5e7
--- /dev/null
+++ b/dom/tests/mochitest/general/frameSelectEvents.html
@@ -0,0 +1,467 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Testing Selection Events</title>
+ <script type="text/javascript" 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)
+ });
+ });
+ }
+
+ // The main test
+ parent.add_task(function *() {
+ yield spin();
+
+ var selectstart = 0;
+ var selectionchange = 0;
+ var inputSelectionchange = 0;
+ var textareaSelectionchange = 0;
+
+ var cancel = false;
+ var selectstartTarget = null;
+
+ function* UpdateSelectEventsOntextControlsPref(aEnabled) {
+ yield SpecialPowers.pushPrefEnv({'set': [['dom.select_events.textcontrols.enabled', aEnabled]]});
+ }
+ yield* UpdateSelectEventsOntextControlsPref(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) {
+ is(aEvent.originalTarget, document,
+ "The original target of selectionchange should be the document");
+ 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* mouseAction(aElement, aOffset, aType,
+ aSelStart, aSelChng, aISelChng, aTSelChng,
+ aYOffset)
+ {
+ if (aType == "click") { // You can simulate a click event by sending undefined
+ aType = undefined;
+ }
+ if (!aYOffset) {
+ aYOffset = 10;
+ }
+ synthesizeMouse(aElement, aOffset, aYOffset, { type: aType });
+ yield spin();
+
+ is(selectstart, aSelStart,
+ "SelStart Mouse Action (" + aOffset + " - " + aType + ")");
+ is(selectionchange, aSelChng,
+ "SelChng Mouse Action (" + aOffset + " - " + aType + ")");
+ is(inputSelectionchange, aISelChng || 0,
+ "ISelChng Mouse Action (" + aOffset + " - " + aType + ")");
+ is(textareaSelectionchange, aTSelChng || 0,
+ "TSelChng Mouse Action (" + aOffset + " - " + aType + ")");
+ reset();
+ }
+
+ function* keyAction(aKey, aShift, aAccel,
+ aSelStart, aSelChng, aISelChng, aTSelChng)
+ {
+ synthesizeKey(aKey, { shiftKey: aShift, accelKey: aAccel });
+ yield spin();
+ is(selectstart, aSelStart,
+ "SelStart Key Action (" + aKey + " - " + aShift + " - " + aAccel + ")");
+ is(selectionchange, aSelChng,
+ "SelChng Key Action (" + aKey + " - " + aShift + " - " + aAccel + ")");
+ is(inputSelectionchange, aISelChng || 0,
+ "ISelChng Key Action (" + aKey + " - " + aShift + " - " + aAccel + ")");
+ is(textareaSelectionchange, aTSelChng || 0,
+ "TSelChng Key Action (" + aKey + " - " + aShift + " - " + aAccel + ")");
+ reset();
+ }
+
+ function* contentEditableAction(aElement, aContentEditable,
+ aSelStart, aSelChng,
+ aISelChng, aTSelChng)
+ {
+ aElement.setAttribute("contenteditable",
+ aContentEditable ? "true" : "false");
+ yield spin();
+
+ is(selectstart, aSelStart,
+ "SelStart ContentEditable Action");
+ is(selectionchange, aSelChng,
+ "SelStart ContentEditable Action");
+ is(inputSelectionchange, aISelChng || 0,
+ "SelStart ContentEditable Action");
+ is(textareaSelectionchange, aTSelChng || 0,
+ "SelStart ContentEditable Action");
+ 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
+ yield* contentEditableAction(elt("ce"), true, 0, 0, 0, 0);
+
+ // Make sure setting the element to not be contentEditable doesn't cause any selectionchange events
+ yield* contentEditableAction(elt("ce"), false, 0, 0, 0, 0);
+
+ // Now make the div contentEditable and proceed with the test
+ yield* contentEditableAction(elt("ce"), true, 0, 0, 0, 0);
+
+ // Focus the contenteditable text
+ yield* mouseAction(elt("ce"), 100, "click", 0, 1);
+ isCollapsed();
+
+ // Move the selection to the right, this should only fire selectstart once
+ selectstartTarget = elt("ce").firstChild;
+ yield* keyAction("VK_RIGHT", true, false, 1, 1);
+ isNotCollapsed();
+ yield* keyAction("VK_RIGHT", true, false, 0, 1);
+ isNotCollapsed();
+
+ // Move it back so that the selection is empty again
+ yield* keyAction("VK_LEFT", true, false, 0, 1);
+ isNotCollapsed();
+ yield* keyAction("VK_LEFT", true, false, 0, 1);
+ isCollapsed();
+
+ // Going from empty to non-empty should fire selectstart again
+ selectstartTarget = elt("ce").firstChild;
+ yield* keyAction("VK_LEFT", true, false, 1, 1);
+ isNotCollapsed();
+
+ function* mouseMoves(aElement, aTarget) {
+ // Select a region
+ yield* mouseAction(aElement, 50, "mousedown", 0, 1);
+ isCollapsed();
+
+ selectstartTarget = aTarget;
+ yield* mouseAction(aElement, 100, "mousemove", 1, 1);
+ isNotCollapsed();
+
+ // Moving it more shouldn't trigger a start (move back to empty)
+ yield* mouseAction(aElement, 75, "mousemove", 0, 1);
+ isNotCollapsed();
+ yield* mouseAction(aElement, 50, "mousemove", 0, 1);
+ isCollapsed();
+
+ // Wiggling the mouse a little such that it doesn't select any
+ // characters shouldn't trigger a selection
+ yield* mouseAction(aElement, 50, "mousemove", 0, 0, 0, 0, 11);
+ isCollapsed();
+
+ // Moving the mouse again from an empty selection should trigger a
+ // selectstart
+ selectstartTarget = aTarget;
+ yield* mouseAction(aElement, 25, "mousemove", 1, 1);
+ isNotCollapsed();
+
+ // Releasing the mouse shouldn't do anything
+ yield* mouseAction(aElement, 25, "mouseup", 0, 0);
+ isNotCollapsed();
+
+ // And neither should moving your mouse around when the mouse
+ // button isn't pressed
+ yield* mouseAction(aElement, 50, "mousemove", 0, 0);
+ isNotCollapsed();
+
+ // Clicking in an random location should move the selection, but not perform a
+ // selectstart
+ yield* mouseAction(aElement, 50, "click", 0, 1);
+ isCollapsed();
+
+ // Clicking there again should do nothing
+ yield* mouseAction(aElement, 50, "click", 0, 0);
+ isCollapsed();
+
+ // Selecting a region, and canceling the selectstart should mean that the
+ // selection remains collapsed
+ yield* mouseAction(aElement, 75, "mousedown", 0, 1);
+ isCollapsed();
+ cancel = true;
+ selectstartTarget = aTarget;
+ yield* mouseAction(aElement, 100, "mousemove", 1, 1);
+ isCollapsed();
+ yield* mouseAction(aElement, 100, "mouseup", 0, 0);
+ isCollapsed();
+ }
+
+ // Should work both on normal
+ yield* mouseMoves(elt("inner"), elt("inner").firstChild);
+ // and contenteditable fields
+ yield* mouseMoves(elt("ce"), elt("ce").firstChild);
+ // and fields with elements in them
+ yield* mouseMoves(elt("normal"), elt("inner").firstChild);
+
+ yield* mouseAction(elt("inner"), 50, "click", 0, 1);
+ isCollapsed();
+
+ reset();
+ // Select all should fire both selectstart and change
+ selectstartTarget = document.body;
+ yield* keyAction("A", false, true, 1, 1);
+ isNotCollapsed();
+
+ // Clear the selection
+ yield* mouseAction(elt("inner"), 50, "click", 0, 1);
+ isCollapsed();
+
+ // Even if we already have a selection
+ yield* mouseAction(elt("inner"), 75, "mousedown", 0, 1);
+ isCollapsed();
+ selectstartTarget = elt("inner").firstChild;
+ yield* mouseAction(elt("inner"), 100, "mousemove", 1, 1);
+ isNotCollapsed();
+ yield* mouseAction(elt("inner"), 100, "mouseup", 0, 0);
+ isNotCollapsed();
+
+ selectstartTarget = document.body;
+ yield* keyAction("A", false, true, 1, 1);
+ isNotCollapsed();
+
+ // Clear the selection
+ yield* mouseAction(elt("inner"), 50, "click", 0, 1);
+ isCollapsed();
+
+ // Make sure that a synthesized selection change doesn't fire selectstart
+ var s = document.getSelection();
+ s.removeAllRanges();
+ yield spin();
+ is(selectstart, 0, "Synthesized range removals shouldn't fire selectstart");
+ is(selectionchange, 1, "Synthesized range removals should change selectionchange");
+ reset();
+ isCollapsed();
+
+ var range = document.createRange();
+ range.selectNode(elt("inner"));
+ s.addRange(range);
+ yield spin();
+ is(selectstart, 0, "Synthesized range additions shouldn't fire selectstart");
+ is(selectionchange, 1, "Synthesized range additions should change selectionchange");
+ reset();
+ isNotCollapsed();
+
+ // Change the range, without replacing
+ range.selectNode(elt("ce"));
+ yield spin();
+ is(selectstart, 0, "Synthesized range mutations shouldn't fire selectstart");
+ is(selectionchange, 1, "Synthesized range mutations should change selectionchange");
+ reset();
+ isNotCollapsed();
+
+ // Remove the range
+ s.removeAllRanges();
+ yield spin();
+ is(selectstart, 0, "Synthesized range removal");
+ is(selectionchange, 1, "Synthesized range removal");
+ reset();
+ isCollapsed();
+
+
+ /*
+ Selection events mouse move on input type=text
+ */
+
+ // Select a region
+
+ // Without the dom.select_events.textcontrols.enabled pref,
+ // pressing the mouse shouldn't do anything.
+ yield* mouseAction(elt("input"), 50, "mousedown", 0, 1, 0, 0);
+
+ // Releasing the mouse shouldn't do anything
+ yield* mouseAction(elt("input"), 50, "mouseup", 0, 0, 0, 0);
+
+ yield* UpdateSelectEventsOntextControlsPref(true);
+
+ yield* mouseAction(elt("input"), 50, "mousedown", 0, 0, 0, 0);
+
+ selectstartTarget = elt("input");
+ yield* mouseAction(elt("input"), 100, "mousemove", 1, 0, 1, 0);
+
+ // Moving it more shouldn't trigger a start (move back to empty)
+ yield* mouseAction(elt("input"), 75, "mousemove", 0, 0, 1, 0);
+ yield* mouseAction(elt("input"), 50, "mousemove", 0, 0, 1, 0);
+
+ // Wiggling the mouse a little such that it doesn't select any
+ // characters shouldn't trigger a selection
+ yield* mouseAction(elt("input"), 50, "mousemove", 0, 0, 0, 0, 11);
+
+ // Moving the mouse again from an empty selection should trigger a
+ // selectstart
+ selectstartTarget = elt("input");
+ yield* mouseAction(elt("input"), 25, "mousemove", 1, 0, 1, 0);
+
+ // Releasing the mouse shouldn't do anything
+ yield* mouseAction(elt("input"), 25, "mouseup", 0, 0, 0, 0);
+
+ // And neither should moving your mouse around when the mouse
+ // button isn't pressed
+ yield* mouseAction(elt("input"), 50, "mousemove", 0, 0, 0, 0);
+
+ // Clicking in an random location should move the selection, but
+ // not perform a selectstart
+ yield* mouseAction(elt("input"), 50, "click", 0, 0, 1, 0);
+
+ // Clicking there again should do nothing
+ yield* mouseAction(elt("input"), 50, "click", 0, 0, 0, 0);
+
+ // Selecting a region, and canceling the selectstart should mean that the
+ // selection remains collapsed
+ yield* mouseAction(elt("input"), 75, "mousedown", 0, 0, 1, 0);
+ cancel = true;
+ selectstartTarget = elt("input");
+ yield* mouseAction(elt("input"), 100, "mousemove", 1, 0, 1, 0);
+ yield* mouseAction(elt("input"), 100, "mouseup", 0, 0, 0, 0);
+
+
+ yield* UpdateSelectEventsOntextControlsPref(false);
+
+ // Without the dom.select_events.textcontrols.enabled pref,
+ // pressing the mouse shouldn't do anything.
+ // XXX For some reason we fire 2 selectchange events on the body
+ // when switching from the input to the text area.
+ yield* mouseAction(elt("textarea"), 50, "mousedown", 0, 2, 0, 0);
+
+ // Releasing the mouse shouldn't do anything
+ yield* mouseAction(elt("textarea"), 50, "mouseup", 0, 0, 0, 0);
+
+ yield* UpdateSelectEventsOntextControlsPref(true);
+
+ // Select a region
+ yield* mouseAction(elt("textarea"), 50, "mousedown", 0, 0, 0, 0);
+
+ selectstartTarget = elt("textarea");
+ yield* mouseAction(elt("textarea"), 100, "mousemove", 1, 0, 0, 1);
+
+ // Moving it more shouldn't trigger a start (move back to empty)
+ yield* mouseAction(elt("textarea"), 75, "mousemove", 0, 0, 0, 1);
+ yield* mouseAction(elt("textarea"), 50, "mousemove", 0, 0, 0, 1);
+
+ // Wiggling the mouse a little such that it doesn't select any
+ // characters shouldn't trigger a selection
+ yield* mouseAction(elt("textarea"), 50, "mousemove", 0, 0, 0, 0, 11);
+
+ // Moving the mouse again from an empty selection should trigger a
+ // selectstart
+ selectstartTarget = elt("textarea");
+ yield* mouseAction(elt("textarea"), 25, "mousemove", 1, 0, 0, 1);
+
+ // Releasing the mouse shouldn't do anything
+ yield* mouseAction(elt("textarea"), 25, "mouseup", 0, 0, 0, 0);
+
+ // And neither should moving your mouse around when the mouse
+ // button isn't pressed
+ yield* mouseAction(elt("textarea"), 50, "mousemove", 0, 0, 0, 0);
+
+ // Clicking in an random location should move the selection, but not perform a
+ // selectstart
+ yield* mouseAction(elt("textarea"), 50, "click", 0, 0, 0, 1);
+
+ // Clicking there again should do nothing
+ yield* mouseAction(elt("textarea"), 50, "click", 0, 0, 0, 0);
+
+ // Selecting a region, and canceling the selectstart should mean that the
+ // selection remains collapsed
+ yield* mouseAction(elt("textarea"), 75, "mousedown", 0, 0, 0, 1);
+ cancel = true;
+ selectstartTarget = elt("textarea");
+ yield* mouseAction(elt("textarea"), 100, "mousemove", 1, 0, 0, 1);
+ yield* mouseAction(elt("textarea"), 100, "mouseup", 0, 0, 0, 0);
+
+ // 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
+ elt("input").setAttribute("style", "display: none;");
+ yield spin();
+ is(selectstart, 0, "idn - ss 1");
+ is(selectionchange, 0, "idn - sc 1");
+ is(inputSelectionchange, 0, "idn - isc 1");
+ is(textareaSelectionchange, 0, "idn - tsc 1");
+ reset();
+
+ elt("input").setAttribute("style", "");
+ yield spin();
+ is(selectstart, 0, "idn - ss 2");
+ is(selectionchange, 0, "idn - sc 2");
+ is(inputSelectionchange, 0, "idn - isc 2");
+ is(textareaSelectionchange, 0, "idn - tsc 2");
+ reset();
+
+ elt("textarea").setAttribute("style", "display: none;");
+ yield spin();
+ is(selectstart, 0, "tdn - ss 1");
+ is(selectionchange, 0, "tdn - sc 1");
+ is(inputSelectionchange, 0, "tdn - isc 1");
+ is(textareaSelectionchange, 0, "tdn - tsc 1");
+ reset();
+
+ elt("textarea").setAttribute("style", "");
+ yield spin();
+ is(selectstart, 0, "tdn - ss 2");
+ is(selectionchange, 0, "tdn - sc 2");
+ is(inputSelectionchange, 0, "tdn - isc 2");
+ is(textareaSelectionchange, 0, "tdn - tsc 2");
+ 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 000000000..62f4ac4b1
--- /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(function* () {
+ // We should be able to access storage
+ yield storageAllowed();
+
+ // We should be able to run a web worker which can access storage
+ yield 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 000000000..7a4733139
--- /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(function* () {
+ // We just check if we can access storage as chrome using special powers!
+ var params = new URLSearchParams(location.search.substr(1));
+ yield 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 000000000..4f58a296f
--- /dev/null
+++ b/dom/tests/mochitest/general/frameStorageNullprincipal.sjs
@@ -0,0 +1,33 @@
+// 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 000000000..3554d6082
--- /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;version=1.7">
+
+ task(function* () {
+ // We shouldn't be able to access storage
+ yield 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();
+ }
+ });
+ }
+
+ yield createWorker();
+ return;
+ }
+
+ // Try to run a worker, which shouldn't be able to access storage
+ yield runWorker("workerStoragePrevented.js");
+ });
+
+</script>
+
+</head>
+
+<body>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/historyframes.html b/dom/tests/mochitest/general/historyframes.html
new file mode 100644
index 000000000..def5fd171
--- /dev/null
+++ b/dom/tests/mochitest/general/historyframes.html
@@ -0,0 +1,156 @@
+<!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="data:text/html,<p%20id='text'>Start</p>"></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;
+}, false);
+
+function waitForLoad() {
+ function listener() {
+ gFrame.removeEventListener("load", listener, false);
+ SimpleTest.executeSoon(continue_test);
+ }
+
+ gFrame.addEventListener("load", listener, false);
+}
+
+function loadContent(aURL) {
+ waitForLoad();
+
+ gFrame.src = aURL;
+}
+
+function getURL() {
+ return gFrame.contentDocument.documentURI;
+}
+
+function getContent() {
+ return gFrame.contentDocument.getElementById("text").textContent;
+}
+
+var START = "data:text/html,<p%20id='text'>Start</p>";
+var URL1 = "data:text/html,<p%20id='text'>Test1</p>";
+var URL2 = "data:text/html,<p%20id='text'>Test2</p>";
+
+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();
+ }
+}
+
+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();
+
+ is(gState, "STATE1", "State should be correct");
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.forward();
+
+ is(gState, "STATE2", "State should be correct");
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.back();
+ window.history.back();
+
+ is(gState, "START", "State should be correct");
+ is(getURL(), URL2, "URL should be correct");
+ is(getContent(), "Test2", "Page should be correct");
+
+ window.history.back();
+ 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();
+ 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 000000000..df421453c
--- /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 000000000..6f76d4438
--- /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 000000000..144a2f0b9
--- /dev/null
+++ b/dom/tests/mochitest/general/image_50.png
Binary files differ
diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini
new file mode 100644
index 000000000..d59527801
--- /dev/null
+++ b/dom/tests/mochitest/general/mochitest.ini
@@ -0,0 +1,128 @@
+[DEFAULT]
+support-files =
+ 497633.html
+ fail.png
+ file_bug628069.html
+ file_clonewrapper.html
+ file_domWindowUtils_scrollbarSize.html
+ file_frameElementWrapping.html
+ file_interfaces.xml
+ file_moving_nodeList.html
+ file_moving_xhr.html
+ file_showModalDialog.html
+ historyframes.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_bug1012662_common.js
+ frameStorageAllowed.html
+ frameStoragePrevented.html
+ frameStorageChrome.html
+ frameStorageNullprincipal.sjs
+ workerStorageAllowed.js
+ workerStoragePrevented.js
+ storagePermissionsUtils.js
+ 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/file_empty.html
+
+[test_497898.html]
+skip-if = toolkit == 'android'
+[test_bug504220.html]
+[test_bug628069_1.html]
+[test_bug628069_2.html]
+[test_bug631440.html]
+[test_bug653364.html]
+[test_bug861217.html]
+[test_bug1012662_editor.html]
+skip-if = (toolkit == 'android') # Disabled on Android, see bug 1230231
+subsuite = clipboard
+[test_bug1012662_noeditor.html]
+subsuite = clipboard
+skip-if = (toolkit == 'android') # Disabled on Android, see bug 1230231
+[test_bug1161721.html]
+[test_bug1170911.html]
+subsuite = clipboard
+[test_bug1208217.html]
+[test_bug1313753.html]
+[test_clientRects.html]
+[test_clipboard_disallowed.html]
+[test_clipboard_events.html]
+subsuite = clipboard
+[test_consoleAPI.html]
+[test_contentViewer_overrideDPPX.html]
+[test_DOMMatrix.html]
+[test_domWindowUtils.html]
+[test_domWindowUtils_scrollbarSize.html]
+[test_domWindowUtils_scrollXY.html]
+[test_donottrack.html]
+[test_focus_legend_noparent.html]
+[test_focusrings.xul]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_for_of.html]
+[test_framedhistoryframes.html]
+[test_frameElementWrapping.html]
+[test_img_mutations.html]
+[test_interfaces.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]
+[test_picture_apng.html]
+[test_picture_mutations.html]
+[test_pointerPreserves3D.html]
+[test_pointerPreserves3DClip.html]
+[test_resource_timing.html]
+[test_resource_timing_cross_origin.html]
+[test_resource_timing_frameset.html]
+[test_selectevents.html]
+skip-if = toolkit == 'android' # bug 1230232 - Mouse doesn't select in the same way
+[test_showModalDialog.html]
+skip-if = e10s || toolkit == 'android' #Don't run modal tests on Android
+[test_showModalDialog_e10s.html]
+run-if = e10s
+[test_storagePermissionsAccept.html]
+[test_storagePermissionsLimitForeign.html]
+[test_storagePermissionsReject.html]
+[test_storagePermissionsRejectForeign.html]
+[test_stylesheetPI.html]
+[test_vibrator.html]
+[test_WebKitCSSMatrix.html]
+[test_windowedhistoryframes.html]
+[test_windowProperties.html]
diff --git a/dom/tests/mochitest/general/navigation_timing.html b/dom/tests/mochitest/general/navigation_timing.html
new file mode 100644
index 000000000..44474468e
--- /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.indexOf("_blank") != -1) {
+ test_blank();
+ return;
+ }
+
+ if (location.href.indexOf("_self") != -1) {
+ 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 000000000..6e78a9eef
--- /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 000000000..81456d44d
--- /dev/null
+++ b/dom/tests/mochitest/general/performance_timeline_main_test.html
@@ -0,0 +1,101 @@
+<!--
+ 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 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() {
+ is(window.performance.getEntriesByType("resource").length, 5, "The number of PerformanceResourceTiming should be 5.");
+ is(receivedBufferFullEvents, 1, "onresourcetimingbufferfull should be called once.");
+ makeXhr("test-data2.json", secondCheck);
+}
+
+function secondCheck() {
+ is(window.performance.getEntriesByType("resource").length, 5, "The number of PerformanceResourceTiming should be 5.");
+ is(receivedBufferFullEvents, 1, "onresourcetimingbufferfull should never be 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();
+}
+
+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/res0.resource b/dom/tests/mochitest/general/res0.resource
new file mode 100644
index 000000000..e69de29bb
--- /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 000000000..e69de29bb
--- /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 000000000..2e5d8ea17
--- /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 000000000..e69de29bb
--- /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 000000000..f19c20d3e
--- /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 000000000..e69de29bb
--- /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 000000000..391a44222
--- /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 000000000..e69de29bb
--- /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 000000000..fbf4a9de7
--- /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 000000000..e69de29bb
--- /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 000000000..1be24a555
--- /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 000000000..e69de29bb
--- /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 000000000..4a570ae67
--- /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 000000000..e69de29bb
--- /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 000000000..d9bbf9462
--- /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 000000000..e69de29bb
--- /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 000000000..21f490fd3
--- /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 000000000..e69de29bb
--- /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 000000000..c5b906280
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_cross_origin.html
@@ -0,0 +1,187 @@
+<!--
+ 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 are 0.
+function checkRedirectCrossOriginResourceSameOrigin(entry) {
+ const checks = { "redirectStart": 0, "redirectEnd": 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"> <!-- same origin, no header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res0.resource"> <!-- cross origin, no header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res1.resource"> <!-- cross origin, Timing-Allow-Origin: * header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res2.resource"> <!-- cross origin redirect to test2.example.com, no header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res3.resource"> <!-- cross origin, Timing-Allow-Origin: http://mochi.test:8888 header -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res4.resource"> <!-- 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"> <!-- cross origin, Timing-Allow-Origin: http://mochi.test:8889 -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res6.resource"> <!-- cross origin, Timing-Allow-Origin: "" (empty string) -->
+ <object data="http://test1.example.com/tests/dom/tests/mochitest/general/res7.resource"> <!-- 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"> <!-- 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 000000000..8d789758b
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_iframe.html
@@ -0,0 +1,49 @@
+<!--
+ 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");
+ window.parent.ok(!window.performance.getEntriesByName(
+ "http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing_iframe.html").length,
+ "This iframe should NOT contain itself as an 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_main_test.html b/dom/tests/mochitest/general/resource_timing_main_test.html
new file mode 100644
index 000000000..864b02984
--- /dev/null
+++ b/dom/tests/mochitest/general/resource_timing_main_test.html
@@ -0,0 +1,288 @@
+<!--
+ 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>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <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;
+
+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;
+ }
+
+ // Here, we should have 5 entries (1 css, 3 png, 1 html) since the image was loaded.
+ is(window.performance.getEntriesByType("resource").length, 5, "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, 5, "No entries should be " +
+ "removed when setResourceTimingBufferSize is called.");
+
+ window.performance.setResourceTimingBufferSize(4);
+ is(window.performance.getEntriesByType("resource").length, 5, "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).
+ allResources = {
+ "http://mochi.test:8888/tests/SimpleTest/test.css" : "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"};
+
+ 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.
+ if (iframeTestsDone) {
+ is(bufferFullCounter, expectedBufferFullEvents, "onresourcetimingbufferfull called a wrong number of times");
+ window.opener.finishTests();
+ } else {
+ mainWindowTestsDone = true;
+ }
+}
+
+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/storagePermissionsUtils.js b/dom/tests/mochitest/general/storagePermissionsUtils.js
new file mode 100644
index 000000000..4d1609d9f
--- /dev/null
+++ b/dom/tests/mochitest/general/storagePermissionsUtils.js
@@ -0,0 +1,237 @@
+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 new Promise((resolve, reject) => {
+ SpecialPowers.pushPrefEnv({"set": [[kPrefName, behavior]]}, resolve);
+ });
+}
+
+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, false);
+
+ 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(false, "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(false, "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));
+ }
+
+ next_step();
+}
+
+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 000000000..7bd0cdaf3
--- /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 000000000..7bd0cdaf3
--- /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 000000000..fdd95e126
--- /dev/null
+++ b/dom/tests/mochitest/general/test_497898.html
@@ -0,0 +1,29 @@
+<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 type="text/javascript" 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 src="data:text/html;charset=utf-8,%3Chtml%3E%0A%3Chead%3E%3C/head%3E%0A%3Cbody%3E%0A%3Cbutton%20id%3D%22a%22%20onfocus%3D%22parent.switchFocus%28%29%22%20onblur%3D%22window.frameElement.parentNode.removeChild%28window.frameElement%29%22%3ESwitching%20focus%20to%20a%20different%20program%20should%20not%20crash%20Mozilla%3C/button%3E%0A%3Cscript%3E%0Adocument.getElementById%28%27a%27%29.focus%28%29%3B%0A%3C/script%3E%0A%3C/body%3E%0A%3C/html%3E"></iframe>
+
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+</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 000000000..14dfac38a
--- /dev/null
+++ b/dom/tests/mochitest/general/test_DOMMatrix.html
@@ -0,0 +1,728 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test DOMMatrix behavior</title>
+ <scriptsrc="/MochiKit/packed.js"></script>
+ <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,
+ testScaleNonUniformInPlace,
+ 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 scaleNonUniform(in float scaleFactorX, in float scaleFactorY);
+function testScaleNonUniformInPlace()
+{
+ var m = createMatrix(2, 0, 0, 1, 120, 100);
+ m.scaleNonUniformSelf(0.5, -3);
+ roughCmpMatrix(m, [1, 0, 0, -3, 120, 100],
+ "Unexpected result after scaleNonUniform");
+}
+
+// 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, true, "should not 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: function(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: function(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: function(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: function(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: function(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: function(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).scaleNonUniformSelf(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(10, 20) scale(.5, 2) rotate(45)");
+ var m2 = new DOMMatrix();
+ m2.translateSelf(10, 20).scaleNonUniformSelf(.5,2).rotateSelf(45);
+ ok(CompareDOMMatrix(m2, m), "string parsing didn't match");
+
+ m = new DOMMatrix();
+ m.setMatrixValue("translate(10, 20) scale(.5, 2) rotate(45)");
+ 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, false);
+
+</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 000000000..3ce0bac66
--- /dev/null
+++ b/dom/tests/mochitest/general/test_WebKitCSSMatrix.html
@@ -0,0 +1,336 @@
+<!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]) {
+ 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 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.scale(2);
+ var m2r = m2.scaleNonUniform(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.scaleNonUniform(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.scaleNonUniform(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.scaleNonUniform(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.scaleNonUniform(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.scaleNonUniform(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 m = new WebKitCSSMatrix("matrix(1,0,0,0,0,0)");
+ assert_throws("NotSupportedError", function() { m.inverse(); }, "Inverting an invertible matrix should throw.")
+}, "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_bug1012662_common.js b/dom/tests/mochitest/general/test_bug1012662_common.js
new file mode 100644
index 000000000..0d1ba2963
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1012662_common.js
@@ -0,0 +1,341 @@
+/** Test for Bug 1012662 **/
+// This test is called from both test_bug1012662_editor.html and test_bug1012662_noeditor.html
+// This is to test that the code works both in the presence of a contentEditable node, and in the absense of one
+var WATCH_TIMEOUT = 300;
+
+// Some global variables to make the debug messages easier to track down
+var gTestN0 = 0, gTestN1 = 0, gTestN2 = 0;
+function testLoc() { return " " + gTestN0 + " - " + gTestN1 + " - " + gTestN2; }
+
+// Listen for cut & copy events
+var gCopyCount = 0, gCutCount = 0;
+document.addEventListener('copy', function() {
+ gCopyCount++;
+});
+document.addEventListener('cut', function() {
+ gCutCount++;
+});
+
+
+// Helper methods
+function selectNode(aSelector, aCb) {
+ var dn = document.querySelector(aSelector);
+ var range = document.createRange();
+ range.selectNodeContents(dn);
+ window.getSelection().removeAllRanges();
+ window.getSelection().addRange(range);
+ if (aCb) {
+ aCb();
+ }
+}
+
+function selectInputNode(aSelector, aCb) {
+ var dn = document.querySelector(aSelector);
+ synthesizeMouse(dn, 10, 10, {});
+ SimpleTest.executeSoon(function() {
+ synthesizeKey("A", {accelKey: true});
+ SimpleTest.executeSoon(aCb);
+ });
+}
+
+// Callback functions for attaching to the button
+function execCut(aShouldSucceed) {
+ var cb = function(e) {
+ e.preventDefault();
+ document.removeEventListener('keydown', cb);
+
+ is(aShouldSucceed, document.execCommand('cut'), "Keydown caused cut invocation" + testLoc());
+ };
+ return cb;
+}
+function execCopy(aShouldSucceed) {
+ var cb = function(e) {
+ e.preventDefault();
+ document.removeEventListener('keydown', cb);
+
+ is(aShouldSucceed, document.execCommand('copy'), "Keydown caused copy invocation" + testLoc());
+ };
+ return cb;
+}
+
+// The basic test set. Tries to cut/copy everything
+function cutCopyAll(aDoCut, aDoCopy, aDone, aNegate, aClipOverride, aJustClipboardNegate) {
+ var execCommandAlwaysSucceed = !!(aClipOverride || aJustClipboardNegate);
+
+ function waitForClipboard(aCond, aSetup, aNext, aNegateOne) {
+ if (aClipOverride) {
+ aCond = aClipOverride;
+ aNegateOne = false;
+ }
+ if (aNegate || aNegateOne || aJustClipboardNegate) {
+ SimpleTest.waitForClipboard(null, aSetup, aNext, aNext, "text/unicode", WATCH_TIMEOUT, true);
+ } else {
+ SimpleTest.waitForClipboard(aCond, aSetup, aNext, aNext);
+ }
+ }
+
+ function validateCutCopy(aExpectedCut, aExpectedCopy) {
+ if (aNegate) {
+ aExpectedCut = aExpectedCopy = 0;
+ } // When we are negating - we always expect callbacks not to be run
+
+ is(aExpectedCut, gCutCount,
+ (aExpectedCut > 0 ? "Expect cut callback to run" : "Expect cut callback not to run") + testLoc());
+ is(aExpectedCopy, gCopyCount,
+ (aExpectedCopy > 0 ? "Expect copy callback to run" : "Expect copy callback not to run") + testLoc());
+ gCutCount = gCopyCount = 0;
+ }
+
+ function step(n) {
+ function nextStep() { step(n + 1); }
+
+ document.querySelector('span').textContent = 'span text';
+ document.querySelector('input[type=text]').value = 'text text';
+ document.querySelector('input[type=password]').value = 'password text';
+ document.querySelector('textarea').value = 'textarea text';
+
+ var contentEditableNode = document.querySelector('div[contentEditable=true]');
+ if (contentEditableNode) {
+ contentEditableNode.textContent = 'contenteditable text';
+ }
+
+ gTestN2 = n;
+ switch (n) {
+ case 0:
+ // copy on readonly selection
+ selectNode('span');
+ waitForClipboard("span text", function() {
+ aDoCopy(true);
+ }, nextStep);
+ return;
+
+ case 1:
+ validateCutCopy(0, 1);
+
+ // cut on readonly selection
+ selectNode('span');
+
+ waitForClipboard("span text", function() {
+ aDoCut(execCommandAlwaysSucceed);
+ }, nextStep, true);
+ return;
+
+ case 2:
+ validateCutCopy(1, 0);
+
+ // copy on textbox selection
+ selectInputNode('input[type=text]', nextStep);
+ return;
+
+ case 3:
+ waitForClipboard("text text", function() {
+ selectInputNode('input[type=text]', function() { aDoCopy(true); });
+ }, nextStep);
+ return;
+
+ case 4:
+ validateCutCopy(0, 1);
+
+ // cut on textbox selection
+ selectInputNode('input[type=text]', nextStep);
+ return;
+
+ case 5:
+ waitForClipboard("text text", function() {
+ aDoCut(true);
+ }, nextStep);
+ return;
+
+ case 6:
+ validateCutCopy(1, 0);
+
+ // copy on password selection
+ selectInputNode('input[type=password]', nextStep);
+ return;
+
+ case 7:
+ waitForClipboard(null, function() {
+ aDoCopy(execCommandAlwaysSucceed);
+ }, nextStep, true);
+ return;
+
+ case 8:
+ validateCutCopy(0, 1);
+
+ // cut on password selection
+ selectInputNode('input[type=password]', nextStep);
+ return;
+
+ case 9:
+ waitForClipboard(null, function() {
+ aDoCut(execCommandAlwaysSucceed);
+ }, nextStep, true);
+ return;
+
+ case 10:
+ validateCutCopy(1, 0);
+
+ // copy on textarea selection
+ selectInputNode('textarea', nextStep);
+ return;
+
+ case 11:
+ waitForClipboard("textarea text", function() {
+ aDoCopy(true);
+ }, nextStep);
+ return;
+
+ case 12:
+ validateCutCopy(0, 1);
+
+ // cut on password selection
+ selectInputNode('textarea', nextStep);
+ return;
+
+ case 13:
+ waitForClipboard("textarea text", function() {
+ aDoCut(true);
+ }, nextStep);
+ return;
+
+ case 14:
+ validateCutCopy(1, 0);
+
+ // copy on no selection
+ document.querySelector('textarea').blur();
+
+ waitForClipboard(null, function() {
+ aDoCopy(true);
+ }, nextStep, true);
+ return;
+
+ case 15:
+ validateCutCopy(0, 1);
+
+ // cut on no selection
+ waitForClipboard(null, function() {
+ aDoCut(execCommandAlwaysSucceed);
+ }, nextStep, true);
+ return;
+
+ case 16:
+ validateCutCopy(1, 0);
+
+ if (!document.querySelector('div[contentEditable=true]')) {
+ // We're done! (no contentEditable node!)
+ step(-1);
+ return;
+ }
+ break;
+
+ case 17:
+ // copy on contenteditable selection
+ waitForClipboard("contenteditable text", function() {
+ selectNode('div[contentEditable=true]', function() {
+ aDoCopy(true);
+ });
+ }, nextStep);
+ return;
+
+ case 18:
+ validateCutCopy(0, 1);
+ break;
+
+ case 19:
+ // cut on contenteditable selection
+ waitForClipboard("contenteditable text", function() {
+ selectNode('div[contentEditable=true]', function() {
+ aDoCut(true);
+ });
+ }, nextStep);
+ return;
+
+ case 20:
+ validateCutCopy(1, 0);
+ break;
+
+ default:
+ aDone();
+ return;
+ }
+
+ SimpleTest.executeSoon(function() { step(n + 1); });
+ }
+
+ step(0);
+}
+
+function allMechanisms(aCb, aClipOverride, aNegateAll) {
+ function testStep(n) {
+ gTestN1 = n;
+ switch (n) {
+ case 0:
+ // Keyboard issued
+ cutCopyAll(function docut(aSucc) {
+ synthesizeKey("X", {accelKey: true});
+ }, function docopy(aSucc) {
+ synthesizeKey("C", {accelKey: true});
+ }, function done() { testStep(n + 1); }, false, aClipOverride, aNegateAll);
+ return;
+
+ case 1:
+ // Button issued
+ cutCopyAll(function docut(aSucc) {
+ document.addEventListener('keydown', execCut(aSucc));
+ synthesizeKey("Q", {});
+ }, function docopy(aSucc) {
+ document.addEventListener('keydown', execCopy(aSucc));
+ synthesizeKey("Q", {});
+ }, function done() { testStep(n + 1); }, false, aClipOverride, aNegateAll);
+ return;
+
+ case 2:
+ // Button issued
+ cutCopyAll(function doCut(aSucc) {
+ is(false, document.execCommand('cut'), "Can't directly execCommand not in a user callback");
+ }, function doCopy(aSucc) {
+ is(false, document.execCommand('copy'), "Can't directly execCommand not in a user callback");
+ }, function done() { testStep(n + 1); }, true, aClipOverride, aNegateAll);
+ return;
+
+ default:
+ aCb();
+ return;
+ }
+
+ SimpleTest.executeSoon(function() { testStep(n + 1); });
+ }
+ testStep(0);
+}
+
+// Run the tests
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestLongerTimeout(5); // On the emulator - this times out occasionally
+SimpleTest.waitForFocus(function() {
+ function justCancel(aEvent) {
+ aEvent.preventDefault();
+ }
+
+ function override(aEvent) {
+ aEvent.clipboardData.setData('text/plain', 'overridden');
+ aEvent.preventDefault();
+ }
+
+ allMechanisms(function() {
+ gTestN0 = 1;
+ document.addEventListener('cut', override);
+ document.addEventListener('copy', override);
+
+ allMechanisms(function() {
+ gTestN0 = 2;
+ document.removeEventListener('cut', override);
+ document.removeEventListener('copy', override);
+ document.addEventListener('cut', justCancel);
+ document.addEventListener('copy', justCancel);
+
+ allMechanisms(function() {
+ SimpleTest.finish();
+ }, null, true);
+ }, 'overridden');
+ });
+});
diff --git a/dom/tests/mochitest/general/test_bug1012662_editor.html b/dom/tests/mochitest/general/test_bug1012662_editor.html
new file mode 100644
index 000000000..c77adcfc7
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1012662_editor.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1012662
+-->
+<head>
+ <title>Test for Bug 1012662</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="text/javascript" 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=1012662">Mozilla Bug 1012662</a>
+<p id="display"></p>
+
+<div id="content">
+ <span>span text</span>
+ <input type="text" value="text text">
+ <input type="password" value="password text">
+ <textarea>textarea text</textarea>
+ <div contentEditable="true">contenteditable text</div>
+</div>
+
+<pre id="test">
+<script type="application/javascript" src="test_bug1012662_common.js"></script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug1012662_noeditor.html b/dom/tests/mochitest/general/test_bug1012662_noeditor.html
new file mode 100644
index 000000000..a3c2be71e
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1012662_noeditor.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1012662
+-->
+<head>
+ <title>Test for Bug 1012662</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="text/javascript" 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=1012662">Mozilla Bug 1012662</a>
+<p id="display"></p>
+
+<div id="content">
+ <span>span text</span>
+ <input type="text" value="text text">
+ <input type="password" value="password text">
+ <textarea>textarea text</textarea>
+</div>
+
+<pre id="test">
+<script type="application/javascript" src="test_bug1012662_common.js"></script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/test_bug1161721.html b/dom/tests/mochitest/general/test_bug1161721.html
new file mode 100644
index 000000000..3e59dd81b
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="text/javascript" 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 000000000..e739a0f32
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="text/javascript" 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);
+ synthesizeKey("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);
+ synthesizeKey("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 000000000..3fdd74549
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1208217.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1208217
+-->
+<head>
+ <title>Test for Bug 1208217</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.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(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 000000000..85a0080b7
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug1313753.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for bug 1313753</title>
+<script type="application/javascript"
+ 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>
+ <li><div id="target" class="panel"></div>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/dom/tests/mochitest/general/test_bug504220.html b/dom/tests/mochitest/general/test_bug504220.html
new file mode 100644
index 000000000..a88180c89
--- /dev/null
+++ b/dom/tests/mochitest/general/test_bug504220.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=504220
+-->
+<head>
+ <title>Test for Bug 504220</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 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;version=1.7">
+
+/** 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();
+ yield undefined;
+ }
+
+ 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 000000000..57690269a
--- /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 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=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;version=1.7">
+
+/** 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 000000000..13ad88db9
--- /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 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=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;version=1.7">
+
+/** 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 000000000..7142bb5cf
--- /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 type="application/javascript" 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();
+}, false);
+
+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 000000000..e77d6d180
--- /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 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=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;version=1.7">
+
+/** 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 000000000..157487d92
--- /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 type="text/javascript" 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 000000000..058db69f9
--- /dev/null
+++ b/dom/tests/mochitest/general/test_clientRects.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML>
+<html id="d9" style="width:800px; height:1000px">
+<head>
+ <title>Tests for getClientRects/getBoundingClientRect</title>
+ <script type="text/javascript" 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 have Array.prototype on its proto chain");
+ clientRects.map(function(rect) {
+ ok(rect instanceof DOMRect, "Should have a DOMRect here");
+ });
+ is(clientRects.length, list.length, "getClientRects().length for element '" + id + "'");
+ var bounds = list.length > 0 ? 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; -moz-column-count:2; -moz-column-gap:0; 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"
+ src="data:text/html,<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"
+ src="data:text/html,<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"
+ src="data:text/html,<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 000000000..71ba09d62
--- /dev/null
+++ b/dom/tests/mochitest/general/test_clipboard_disallowed.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Clipboard Events</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/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>
+<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 exception;
+ try {
+ clipboardData.mozSetDataAt("text/customdata", document.getElementById("input"), 0);
+ } catch(ex) {
+ exception = ex;
+ }
+ is(String(exception).indexOf("SecurityError"), 0, "Cannot set non-string");
+
+ exception = null;
+ try {
+ clipboardData.mozSetDataAt("application/x-moz-file", "Test", 0);
+ } catch(ex) {
+ exception = ex;
+ }
+ is(String(exception).indexOf("SecurityError"), 0, "Cannot set file");
+
+ exception = null;
+ try {
+ clipboardData.mozSetDataAt("application/x-moz-file-promise", "Test", 0);
+ } catch(ex) {
+ exception = ex;
+ }
+ is(String(exception).indexOf("SecurityError"), 0, "Cannot set file promise");
+
+ exception = null;
+ try {
+ clipboardData.mozSetDataAt("application/something", "This is data", 0);
+ } catch(ex) {
+ exception = ex;
+ }
+ is(exception, null, "Can set custom data to a string");
+ 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 000000000..eb8e0258f
--- /dev/null
+++ b/dom/tests/mochitest/general/test_clipboard_events.html
@@ -0,0 +1,725 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Clipboard Events</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/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>
+<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>
+
+<pre id="test">
+<script class="testbody" type="text/javascript;version=1.7">
+
+var content = document.getElementById("content");
+var contentInput = document.getElementById("content-input");
+var clipboardInitialValue = "empty";
+
+// 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.
+var cb_text = "empty_" + Math.random();
+setClipboardText(cb_text);
+
+is(getClipboardText(), cb_text, "set/get clipboard text failed");
+
+var cachedCutData, cachedCopyData, cachedPasteData;
+
+// A list of test functions to run. 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.
+var testFunctions = [
+ test_dom_oncopy,
+ test_dom_oncut,
+ test_dom_onpaste,
+ test_dom_oncopy_abort,
+ test_input_oncopy,
+ test_input_oncut,
+ test_input_onpaste,
+ test_input_oncopy_abort,
+ test_input_oncut_abort,
+ test_input_onpaste_abort,
+ test_input_cut_dataTransfer,
+ test_input_cut_abort_dataTransfer,
+ test_input_copy_dataTransfer,
+ test_input_paste_dataTransfer,
+ test_input_paste_abort_dataTransfer,
+ test_input_copypaste_dataTransfer_multiple,
+ test_input_copy_button_dataTransfer,
+ test_eventspref_disabled,
+ test_image_dataTransfer,
+ ];
+
+function doTests()
+{
+ // Init clipboard
+ setClipboardText(clipboardInitialValue);
+
+ // Reset value of contentInput.
+ contentInput.value = "INPUT TEXT";
+
+ if (testFunctions.length) {
+ let func = testFunctions.shift();
+ let result = func();
+ if (result instanceof Promise) {
+ result.then(doTests);
+ }
+ else {
+ doTests();
+ }
+ }
+ else {
+ // Check if the cached clipboard data can be accessed or modified
+ // and whether it modifies the real clipboard
+ checkCachedDataTransfer(cachedCutData, "cut");
+ checkCachedDataTransfer(cachedCopyData, "copy");
+ checkCachedDataTransfer(cachedPasteData, "paste");
+
+ checkSyntheticEvents();
+
+ SimpleTest.finish();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function getClipboardText() {
+ return SpecialPowers.getClipboardData("text/unicode");
+}
+
+
+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.select();
+ contentInput.focus();
+}
+
+function test_dom_oncopy() {
+ // 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 {
+ synthesizeKey("c", {accelKey: 1});
+ ok(oncopy_fired, "copy event firing on DOM element");
+ is(getClipboardText(), "CONTENT TEXT",
+ "copy on DOM element set clipboard correctly");
+ } finally {
+ content.oncopy = null;
+ }
+}
+
+function test_dom_oncut() {
+ // 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 is clipboardInitialValue, NOT "CONTENT TEXT".
+ selectContentDiv();
+ var oncut_fired = false;
+ content.oncut = function() { oncut_fired = true; };
+ try {
+ synthesizeKey("x", {accelKey: 1});
+ ok(oncut_fired, "cut event firing on DOM element")
+ is(getClipboardText(), clipboardInitialValue,
+ "cut on DOM element did not modify clipboard");
+ } finally {
+ content.oncut = null;
+ }
+}
+
+
+function test_dom_onpaste() {
+ // 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; };
+ try {
+ synthesizeKey("v", {accelKey: 1});
+ ok(onpaste_fired, "paste event firing on DOM element");
+ } finally {
+ content.onpaste = null;
+ }
+}
+
+
+function test_dom_oncopy_abort() {
+ // 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 {
+ synthesizeKey("c", {accelKey: 1});
+ ok(oncopy_fired, "copy event (to-be-cancelled) firing on DOM element");
+ is(getClipboardText(), clipboardInitialValue,
+ "aborted copy on DOM element did not modify clipboard");
+ } finally {
+ content.oncopy = null;
+ }
+}
+
+
+function test_input_oncopy() {
+ // 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);
+
+ var oncopy_fired = false;
+ contentInput.oncopy = function() { oncopy_fired = true; };
+ try {
+ synthesizeKey("c", {accelKey: 1});
+ ok(oncopy_fired, "copy event firing on plaintext editor");
+ is(getClipboardText(), "PUT TE",
+ "copy on plaintext editor set clipboard correctly");
+ } finally {
+ contentInput.oncopy = null;
+ }
+}
+
+
+function test_input_oncut() {
+ // 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();
+ var oncut_fired = false;
+ contentInput.oncut = function() { oncut_fired = true; };
+ try {
+ synthesizeKey("x", {accelKey: 1});
+ ok(oncut_fired, "cut event firing on plaintext editor");
+ is(getClipboardText(), "INPUT TEXT",
+ "cut on plaintext editor set clipboard correctly");
+ is(contentInput.value, "",
+ "cut on plaintext editor emptied editor");
+ } finally {
+ contentInput.oncut = null;
+ }
+}
+
+
+function test_input_onpaste() {
+ // 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();
+ var onpaste_fired = false;
+ contentInput.onpaste = function() { onpaste_fired = true; };
+ try {
+ 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(contentInput.value, clipboardInitialValue,
+ "paste on plaintext editor did modify editor value");
+ } finally {
+ contentInput.onpaste = null;
+ }
+}
+
+
+function test_input_oncopy_abort() {
+ // Setup an oncopy event handler, fire copy. Ensure that the event
+ // handler was called, and that the clipboard value did NOT change.
+ selectContentInput();
+ var oncopy_fired = false;
+ contentInput.oncopy = function() { oncopy_fired = true; return false; };
+ try {
+ synthesizeKey("c", {accelKey: 1});
+ ok(oncopy_fired, "copy event (to-be-cancelled) firing on plaintext editor");
+ is(getClipboardText(), clipboardInitialValue,
+ "aborted copy on plaintext editor did not modify clipboard");
+ } finally {
+ contentInput.oncopy = null;
+ }
+}
+
+
+function test_input_oncut_abort() {
+ // 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();
+ var oncut_fired = false;
+ contentInput.oncut = function() { oncut_fired = true; return false; };
+ try {
+ synthesizeKey("x", {accelKey: 1});
+ ok(oncut_fired, "cut event (to-be-cancelled) firing on plaintext editor");
+ is(getClipboardText(), clipboardInitialValue,
+ "aborted cut on plaintext editor did not modify clipboard.");
+ is(contentInput.value, "INPUT TEXT",
+ "aborted cut on plaintext editor did not modify editor contents");
+ } finally {
+ contentInput.oncut = null;
+ }
+}
+
+
+function test_input_onpaste_abort() {
+ // 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();
+ var onpaste_fired = false;
+ contentInput.onpaste = function() { onpaste_fired = true; return false; };
+ try {
+ 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");
+ } finally {
+ contentInput.onpaste = null;
+ }
+}
+
+
+function test_input_cut_dataTransfer() {
+ // 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(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 {
+ synthesizeKey("x", {accelKey: 1});
+ is(getClipboardText(), "INPUT TEXT",
+ "cut using dataTransfer on plaintext editor set clipboard correctly");
+ is(contentInput.value, "",
+ "cut using dataTransfer on plaintext editor cleared input");
+ } finally {
+ contentInput.oncut = null;
+ }
+}
+
+
+function test_input_cut_abort_dataTransfer() {
+ // 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 {
+ synthesizeKey("x", {accelKey: 1});
+ is(getClipboardText(), "Cut dataTransfer text",
+ "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");
+ } finally {
+ contentInput.oncut = null;
+ }
+}
+
+
+function test_input_copy_dataTransfer() {
+ // 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(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 {
+ synthesizeKey("c", {accelKey: 1});
+ is(getClipboardText(), "INPUT TEXT",
+ "copy using dataTransfer on plaintext editor set clipboard correctly");
+ is(contentInput.value, "INPUT TEXT",
+ "copy using dataTransfer on plaintext editor did not modify input");
+ } finally {
+ contentInput.oncopy = null;
+ }
+}
+
+
+function test_input_copy_abort_dataTransfer() {
+ // Copy using event.dataTransfer but cancel the event.
+ selectContentInput();
+ contentInput.oncopy = function(event) {
+ event.clipboardData.setData("text/plain", "Copy dataTransfer text");
+ return false;
+ };
+ try {
+ synthesizeKey("x", {accelKey: 1});
+ is(getClipboardText(), "Copy dataTransfer text",
+ "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");
+ } finally {
+ contentInput.oncopy = null;
+ }
+}
+
+
+function test_input_paste_dataTransfer() {
+ // 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(event.clipboardData.mozItemCount, 1, "paste event mozItemCount");
+ is(event.clipboardData.getData("text/plain"), clipboardInitialValue, "paste event getData");
+ cachedPasteData = event.clipboardData;
+ };
+ try {
+ 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");
+ } finally {
+ contentInput.onpaste = null;
+ }
+}
+
+
+function test_input_paste_abort_dataTransfer() {
+ // 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;
+ };
+ try {
+ 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");
+ } finally {
+ contentInput.onpaste = null;
+ }
+}
+
+function test_input_copypaste_dataTransfer_multiple() {
+ // 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 { cd.mozSetDataAt("text/plain", "Text", 1); } catch (ex) { exh = true; }
+ ok(exh, "exception occured mozSetDataAt 1");
+ exh = false;
+ try { cd.mozTypesAt(1); } catch (ex) { exh = true; }
+ ok(exh, "exception occured mozTypesAt 1");
+ exh = false;
+ try { 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");
+ cd.mozSetDataAt("text/x-custom", "Custom Text with \u0000 null", 0);
+ is(cd.mozItemCount, 1, "mozItemCount after set multiple types");
+ return false;
+ };
+
+ try {
+ selectContentInput();
+ synthesizeKey("c", {accelKey: 1});
+ }
+ finally {
+ contentInput.oncopy = null;
+ }
+
+ is(getClipboardText(), "would be a phrase", "copy multiple types text");
+
+ contentInput.setSelectionRange(5, 14);
+
+ contentInput.onpaste = function(event) {
+ var cd = event.clipboardData;
+ is(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.indexOf("Android") == -1) {
+ 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");
+ };
+ try {
+ synthesizeKey("v", {accelKey: 1});
+ is(contentInput.value, "This would be a phrase of text",
+ "default paste after copy multiple types");
+ } finally {
+ contentInput.onpaste = null;
+ }
+}
+
+function test_input_copy_button_dataTransfer() {
+ // 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
+ synthesizeKey("c", {accelKey: 1});
+ is(getClipboardText(), clipboardInitialValue,
+ "copy using dataTransfer on plaintext editor set clipboard correctly for button");
+
+ selectContentDiv();
+ synthesizeKey("c", {accelKey: 1});
+ is(getClipboardText(), "CONTENT TEXT",
+ "copy using dataTransfer with selection on plaintext editor set clipboard correctly for button");
+
+ } finally {
+ document.documentElement.oncopy = null;
+ }
+}
+
+function test_eventspref_disabled() {
+ // Disable clipboard events
+ return new Promise(resolve => {
+ SpecialPowers.pushPrefEnv({"set": [['dom.event.clipboardevents.enabled', false]]}, doPrefDisabledTest);
+
+ function doPrefDisabledTest() {
+ var event_fired = false;
+ contentInput.oncut = function() { event_fired = true; };
+ contentInput.oncopy = function() { event_fired = true; };
+ contentInput.onpaste = function() { event_fired = true; };
+ try {
+ selectContentInput();
+ contentInput.setSelectionRange(1, 4);
+ synthesizeKey("x", {accelKey: 1});
+ is(contentInput.value, "IT TEXT", "cut changed text when preference is disabled");
+ is(getClipboardText(), "NPU", "cut changed clipboard when preference is disabled");
+ ok(!event_fired, "cut event did not fire when preference is disabled")
+
+ event_fired = false;
+ contentInput.setSelectionRange(3, 6);
+ synthesizeKey("c", {accelKey: 1});
+ is(getClipboardText(), "TEX", "copy changed clipboard when preference is disabled");
+ ok(!event_fired, "copy event did not fire when preference is disabled")
+
+ 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")
+ } finally {
+ contentInput.oncut = null;
+ contentInput.oncopy = null;
+ contentInput.onpaste = null;
+ }
+
+ SpecialPowers.popPrefEnv(resolve);
+ }
+ });
+}
+
+let expectedData = [];
+
+// Check to make that synthetic events do not change the clipboard
+function checkSyntheticEvents()
+{
+ let syntheticSpot = document.getElementById("syntheticSpot");
+ setClipboardText(clipboardInitialValue);
+
+ // 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(event.clipboardData.mozItemCount, 0, "synthetic " + eventtype + " empty data");
+ }
+ else {
+ is(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;
+ }
+}
+
+function checkCachedDataTransfer(cd, eventtype)
+{
+ var testprefix = "cached " + eventtype + " dataTransfer";
+
+ setClipboardText("Some Clipboard Text");
+
+ var oldtext = cd.getData("text/plain");
+ ok(oldtext != "Some Clipboard Text", "clipboard get using " + testprefix);
+
+ var exh = false;
+ try { cd.mozSetDataAt("text/plain", "Test Cache Data", 0); } catch (ex) { exh = true; }
+ ok(eventtype == "paste" ? exh : !exh, "exception occured setting " + testprefix);
+
+ var newtext = (eventtype == "paste") ? cd.getData("text/plain") :
+ cd.mozGetDataAt("text/plain", 0);
+ is(newtext, (eventtype == "paste") ? oldtext : "Test Cache Data",
+ " clipboardData not changed using " + testprefix);
+
+ is(getClipboardText(), "Some Clipboard Text", "clipboard not changed using " + testprefix);
+
+ var exh = false;
+ try { cd.mozClearDataAt("text/plain", 0); } catch (ex) { exh = true; }
+ ok(eventtype == "paste" ? exh : !exh, "exception occured clearing " + testprefix);
+
+ is(getClipboardText(), "Some Clipboard Text", "clipboard not changed using " + testprefix);
+}
+
+// Try copying an image to the clipboard and make sure that it looks correct when pasting it.
+function test_image_dataTransfer() {
+ // cmd_copyImageContents errors on Android (bug 1299578).
+ if (navigator.userAgent.includes("Android")) {
+ return;
+ }
+
+ // Copy the image's data to the clipboard
+ SpecialPowers.setCommandNode(window, document.getElementById("image"));
+ SpecialPowers.doCommand(window, "cmd_copyImageContents");
+
+ 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;
+ }
+
+ try {
+ synthesizeKey("v", {accelKey: 1});
+ ok(onpasteCalled, "The paste event listener must have been called");
+ } finally {
+ document.onpaste = null;
+ }
+}
+
+SimpleTest.waitForFocus(doTests);
+
+</script>
+</pre>
+</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 000000000..8d710a51a
--- /dev/null
+++ b/dom/tests/mochitest/general/test_consoleAPI.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>window.console test</title>
+ <script type="text/javascript" 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;version=1.8">
+
+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",
+ "timeEnd": "function",
+ "profile": "function",
+ "profileEnd": "function",
+ "assert": "function",
+ "count": "function",
+ "table": "function",
+ "clear": "function",
+ "dirxml": "function",
+ "markTimeline": "function",
+ "timeline": "function",
+ "timelineEnd": "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 000000000..f7e2024f6
--- /dev/null
+++ b/dom/tests/mochitest/general/test_contentViewer_overrideDPPX.html
@@ -0,0 +1,358 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>nsIContentViewer::overrideDPPX test</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+
+<body>
+
+<iframe></iframe>
+
+<script type="application/javascript;version=1.8">
+
+SimpleTest.waitForExplicitFinish();
+
+const frameWindow = document.querySelector("iframe").contentWindow;
+
+const originalDPR = window.devicePixelRatio;
+const originalZoom = SpecialPowers.getFullZoom(window);
+const dppx = originalDPR * 1.5;
+const zoom = originalZoom * 0.5;
+
+const setOverrideDPPX = (value) => {
+ if (value > 0) {
+ info(`override window's dppx to ${value}`);
+ } else {
+ info(`restore window's dppx to default value`);
+ }
+
+ SpecialPowers.setOverrideDPPX(window, value);
+}
+
+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 gTests = {
+ "test overrideDPPX with devicePixelRatio": (done) => {
+ assertValuesAreInitial();
+
+ setOverrideDPPX(dppx);
+
+ is(window.devicePixelRatio, dppx,
+ "devicePixelRatio overridden.");
+ is(frameWindow.devicePixelRatio, dppx,
+ "frame's devicePixelRatio overridden.");
+
+ 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": (done) => {
+ assertValuesAreInitial();
+
+ setFullZoom(zoom);
+ setOverrideDPPX(dppx);
+
+ is(window.devicePixelRatio, dppx,
+ "devicePixelRatio overridden; fullZoom ignored");
+ is(frameWindow.devicePixelRatio, dppx,
+ "frame's devicePixelRatio overridden; fullZoom ignored");
+
+ 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": (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");
+
+ 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.");
+
+ 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": (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);
+ 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.");
+
+ 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 = [
+ new Promise(resolve => {
+ let mql = window.matchMedia(`(resolution: ${dppx}dppx)`);
+
+ mql.addListener(function listener() {
+ ok("MediaQueryList's listener invoked.")
+ mql.removeListener(listener);
+ resolve();
+ });
+ }),
+ new Promise(resolve => {
+ let mql = frameWindow.matchMedia(`(resolution: ${dppx}dppx)`);
+
+ mql.addListener(function listener() {
+ ok("frame's MediaQueryList's listener invoked.")
+ mql.removeListener(listener);
+ resolve();
+ });
+ })
+ ];
+
+ Promise.all(promises)
+ .then(() => setOverrideDPPX(0))
+ .then(done, e => {throw e});
+
+ setOverrideDPPX(dppx);
+ },
+ "test OverrideDPPX with MediaQueryList and fullZoom": (done) => {
+ assertValuesAreInitial();
+
+ let overridden = false;
+
+ let promises = [
+ new Promise(resolve => {
+ let mql = window.matchMedia(`(resolution: ${dppx}dppx)`);
+
+ mql.addListener(function listener() {
+ ok("MediaQueryList's listener for dppx invoked.");
+ mql.removeListener(listener);
+ overridden = true;
+ resolve();
+ });
+ }),
+ new Promise(resolve => {
+ let mql = window.matchMedia(`(resolution: ${originalDPR * zoom}dppx)`);
+
+ mql.addListener(function listener() {
+ ok(overridden,
+ "MediaQueryList's listener for zoom invoked in the right order");
+
+ mql.removeListener(listener);
+ resolve();
+ });
+ })
+ ];
+
+ promises[0]
+ .then(() => setOverrideDPPX(0))
+ .then(promises[1])
+ .then(() => setFullZoom(originalZoom))
+ .then(done, e => {throw e});
+
+ setOverrideDPPX(dppx);
+ setFullZoom(zoom);
+ },
+ "test OverrideDPPX is kept on document navigation": (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");
+
+ 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", function listener() {
+ this.removeEventListener("load", listener);
+
+ 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();
+
+ setOverrideDPPX(0);
+
+ done();
+ });
+
+ frameWindow.location.reload(true);
+ }
+};
+
+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_domWindowUtils.html b/dom/tests/mochitest/general/test_domWindowUtils.html
new file mode 100644
index 000000000..377900c80
--- /dev/null
+++ b/dom/tests/mochitest/general/test_domWindowUtils.html
@@ -0,0 +1,197 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test nsIDOMWindowUtils</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" 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;version=1.8">
+
+SimpleTest.waitForExplicitFinish();
+
+var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
+
+var gTests = [
+/*
+ nsIDOMElement elementFromPoint(in long aX,
+ in long aY,
+ in boolean aIgnoreRootScrollFrame,
+ in boolean aFlushLayout);
+*/
+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 " + testData[i][0].toSource());
+ }
+
+ SimpleTest.executeSoon(function() {
+ next();
+ });
+},
+
+/**
+ * Test .isHandlingUserInput attribute.
+ */
+function testHandlingUserInput() {
+ ok('isHandlingUserInput' in domWindowUtils,
+ "isHandlingUserInput should be present");
+
+ is(domWindowUtils.isHandlingUserInput, false,
+ "isHandlingUserInput should return false if nothing is happening");
+
+ function testEvents() {
+ var data = [
+ {
+ eventName: "click",
+ result: true,
+ },
+ {
+ eventName: "mousemove",
+ result: false,
+ },
+ {
+ eventName: "mouseup",
+ result: true,
+ },
+ {
+ eventName: "mousedown",
+ result: true,
+ },
+ {
+ eventName: "keydown",
+ result: true,
+ },
+ {
+ eventName: "keyup",
+ result: true,
+ },
+ ];
+
+ for (let i=0; i<data.length; ++i) {
+ document.addEventListener(data[i].eventName, function() {
+ document.removeEventListener(data[i].eventName, arguments.callee);
+
+ is(domWindowUtils.isHandlingUserInput, data[i].result,
+ "isHandlingUserInput should be " + data[i].result);
+
+ SimpleTest.executeSoon(function() {
+ try { testEventsRunner.next(); } catch (e) { }
+ });
+ });
+
+ SimpleTest.executeSoon(function() {
+ if (data[i].eventName == "click") {
+ synthesizeMouseAtCenter(document.body, {});
+ } else if (data[i].eventName.indexOf("key") == 0) {
+ synthesizeKey("VK_A", { type: data[i].eventName });
+ } else {
+ synthesizeMouseAtCenter(document.body, { type: data[i].eventName });
+ }
+ });
+
+ yield undefined;
+ }
+
+ SimpleTest.executeSoon(function() {
+ next();
+ });
+ }
+
+ var testEventsRunner = testEvents();
+ testEventsRunner.next();
+},
+];
+
+function runner() {
+ for (let i=0; i<gTests.length; ++i) {
+ gTests[i]();
+ yield undefined;
+ }
+
+ SimpleTest.finish();
+};
+
+var gTestRunner = runner();
+
+function next() {
+ try { gTestRunner.next(); } catch (e) { if (e != StopIteration) { throw e; } }
+}
+
+// Run the test from onload, since the onscreen and offscreen divs should be in
+// the right places by then.
+addLoadEvent(function() {
+ gTestRunner.next();
+});
+
+</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 000000000..c6ee89ee3
--- /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 type="text/javascript" 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;version=1.8">
+ /*
+ 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(scrollX.value, vals[0], "getScrollXY x for test: " + testName);
+ is(scrollY.value, vals[1], "getScrollXY y for test: " + testName);
+ }
+
+ function checkWindowScrollState(vals, testName) {
+ is(cwindow.scrollX, vals[0], "scrollX for test: " + testName);
+ is(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(scrollX.value, 0, "scrollX is zero for display:none iframe");
+ is(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 src="data:text/html,<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 000000000..b440870fd
--- /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 type="text/javascript" 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;version=1.8">
+ 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 000000000..837f984f8
--- /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 type="application/javascript" 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 000000000..015fead38
--- /dev/null
+++ b/dom/tests/mochitest/general/test_focus_legend_noparent.html
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script type="text/javascript" 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_focusrings.xul b/dom/tests/mochitest/general/test_focusrings.xul
new file mode 100644
index 000000000..dd91c23e9
--- /dev/null
+++ b/dom/tests/mochitest/general/test_focusrings.xul
@@ -0,0 +1,175 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script type="application/javascript"
+ src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript"
+ src="/tests/SimpleTest/EventUtils.js"></script>
+<script type="application/javascript"
+ src="/tests/SimpleTest/WindowSnapshot.js"></script>
+
+<html:style xmlns:html="http://www.w3.org/1999/xhtml" type="text/css">
+* { outline: none; }
+#l1:-moz-focusring, #l3:-moz-focusring, #b1:-moz-focusring { outline: 2px solid red; }
+#l2:focus, #b2:focus { outline: 2px solid red; }
+</html:style>
+
+<script>
+<![CDATA[
+
+SimpleTest.waitForExplicitFinish();
+
+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");
+}
+
+function initTest()
+{
+ SpecialPowers.pushPrefEnv({"set": [['accessibility.tabfocus', 7]]}, runTest);
+}
+
+function runTest()
+{
+ var isMac = (navigator.platform.indexOf("Mac") >= 0);
+ var isWin = (navigator.platform.indexOf("Win") >= 0);
+
+ 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 (navigator.platform.indexOf("Mac") >= 0) {
+ var focusedButton = $("b3");
+ ok(compareSnapshots(snapShot(focusedButton), snapShot($("b2")), true)[0], "unfocused shows no ring");
+ focusedButton.focus();
+ ok(compareSnapshots(snapShot(focusedButton), snapShot($("b2")), false)[0], "focus shows ring");
+ }
+
+ 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 = (!isWin || getComputedStyle($("l1"), "").outlineWidth == "2px");
+ testHTMLElements(htmlElements, isMac, isWin && !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"), expectedVisible, "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"), !isMac && expectedVisible, "appearance on button after mouse focus with :moz-focusring");
+ if (navigator.platform.indexOf("Mac") >= 0) {
+ ok(compareSnapshots(snapShot($("b1")), snapShot($("b2")), false)[0], "focus after mouse shows no ring");
+ }
+
+ synthesizeMouse($("b2"), 4, 4, { });
+ checkFocus($("b2"), !isMac, "appearance on button after mouse focus with :focus");
+
+ // after a key is pressed, the focus ring will always be visible
+ $("l2").focus();
+ synthesizeKey("VK_TAB", { });
+ checkFocus($("l3"), true, "appearance on list after tab focus");
+
+ if (isMac) {
+ SpecialPowers.pushPrefEnv({"set": [['accessibility.mouse_focuses_formcontrol', true]]}, testMacFocusesFormControl);
+ }
+ else {
+ SimpleTest.finish();
+ }
+}
+
+function testMacFocusesFormControl()
+{
+ testHTMLElements(htmlElementsMacPrefSet, true, false);
+ SimpleTest.finish();
+}
+
+var htmlElements = [
+ "<button id='elem'>Button</button>",
+ "<input id='elem' class='canfocus'>",
+ "<input id='elem' type='password' class='canfocus'>",
+ "<input id='elem' type='button'>",
+ "<input id='elem' type='checkbox'>",
+ "<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 testHTMLElements(list, isMac, expectedNoRingsOnWin)
+{
+ var childwin = frames[0];
+ var childdoc = childwin.document;
+ var container = childdoc.getElementById("container");
+ for (var e = 0; e < list.length; e++) {
+ container.innerHTML = list[e];
+
+ var elem = container.firstChild;
+
+ var shouldFocus = !isMac || (elem.className == "canfocus");
+ var ringSize = (shouldFocus ? (expectedNoRingsOnWin ? 2 : 1) : 0) + "px";
+ if (elem.localName == "a")
+ ringSize = "0px";
+
+ synthesizeMouse(elem, 8, 8, { }, childwin);
+ is(childdoc.activeElement, shouldFocus ? elem : childdoc.body, "mouse click on " + list[e]);
+ is(childwin.getComputedStyle(elem, "").outlineWidth, ringSize, "mouse click on " + list[e] + " ring");
+
+ if (childdoc.activeElement)
+ childdoc.activeElement.blur();
+
+ ringSize = (elem.localName == "a" ? "0" : (expectedNoRingsOnWin ? 2 : 1)) + "px";
+
+ elem.focus();
+ is(childdoc.activeElement, elem, "focus() on " + list[e]);
+ is(childwin.getComputedStyle(elem, "").outlineWidth, ringSize,
+ "focus() on " + list[e] + " ring");
+
+ childdoc.activeElement.blur();
+ }
+}
+
+SimpleTest.waitForFocus(runTest);
+
+]]>
+</script>
+
+<listbox id="l1" class="plain" height="20"/>
+<listbox id="l2" class="plain" height="20"/>
+<listbox 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="data:text/html,&lt;html&gt;&lt;style&gt;* { outline: none; -moz-appearance: none; } %23elem:focus { outline: 2px solid red; } %23elem:-moz-focusring { outline: 1px solid blue; }&lt;/style&gt;&lt;div id='container'&gt;&lt;/html&gt;"/>
+
+<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 000000000..0f8ddc603
--- /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 type="text/javascript" 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 000000000..33bc7fdde
--- /dev/null
+++ b/dom/tests/mochitest/general/test_frameElementWrapping.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for same-origin and cross-origin wrapping of frameElement</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>
+<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(',')) },
+ false);
+
+</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 000000000..b69817808
--- /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 type="application/javascript" 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_idleapi_permissions.html b/dom/tests/mochitest/general/test_idleapi_permissions.html
new file mode 100644
index 000000000..4f690f462
--- /dev/null
+++ b/dom/tests/mochitest/general/test_idleapi_permissions.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for idle api permissions</title>
+ <script type="application/javascript" 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>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+var idleObserver = {
+ onidle: null,
+ onactive: null
+};
+
+function doAddIdleObserver(obs) {
+ var i = document.createElement("iframe");
+ document.body.appendChild(i);
+ var added = false;
+ try {
+ i.contentWindow.navigator.addIdleObserver(obs);
+ added = true;
+ } catch (e) { }
+ i.remove();
+ return added;
+}
+
+function run_test() {
+ // addIdleObserver checks whether time is > 0.
+ this.idleObserver.time = 100;
+
+ SpecialPowers.pushPermissions([{type: "idle", allow: true, context: document}], () => {
+ added = doAddIdleObserver(this.idleObserver, true);
+ ok(added, "Should be able to add idle observer with permission.");
+ SimpleTest.finish();
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(run_test);
+</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 000000000..a6fca3f81
--- /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 type="application/javascript" 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", 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 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.xul b/dom/tests/mochitest/general/test_innerScreen.xul
new file mode 100644
index 000000000..55666c28a
--- /dev/null
+++ b/dom/tests/mochitest/general/test_innerScreen.xul
@@ -0,0 +1,89 @@
+<?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 type="text/javascript" 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 domWindowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils);
+ var devPxPerCSSPx = domWindowUtils.screenPixelsPerCSSPixel;
+
+ is(window.devicePixelRatio, devPxPerCSSPx, "window.devicePixelRatio");
+
+ var windowBO = document.documentElement.boxObject;
+ isRounded(window.mozInnerScreenX*devPxPerCSSPx, windowBO.screenX,
+ "window screen X");
+ isRounded(window.mozInnerScreenY*devPxPerCSSPx, windowBO.screenY,
+ "window screen Y");
+
+ var f = document.getElementById("f");
+ var fBounds = f.getBoundingClientRect();
+
+ const CI = Components.interfaces;
+ var fshell = f.contentWindow.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIWebNavigation).QueryInterface(CI.nsIDocShell);
+ var fmudv = fshell.contentViewer;
+
+ isRounded(f.contentWindow.mozInnerScreenX,
+ window.mozInnerScreenX + fBounds.left,
+ "frame screen X");
+ isRounded(f.contentWindow.mozInnerScreenY,
+ window.mozInnerScreenY + fBounds.top,
+ "frame screen Y");
+
+ fmudv.fullZoom *= 2;
+ var frameDomWindowUtils = f.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils);
+ is(frameDomWindowUtils.screenPixelsPerCSSPixel, 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");
+ fmudv.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 000000000..acbc12e07
--- /dev/null
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -0,0 +1,1383 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=766694
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 766694</title>
+ <script type="application/javascript" 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>
+<pre id="test">
+<script type="application/javascript">
+
+/** 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.
+
+// 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: "FancyControl", xbl: true},
+// {name: "DisabledEverywhere", disabled: true},
+// ];
+//
+// See createInterfaceMap() below for a complete list of properties.
+
+// IMPORTANT: Do not change this list without review from
+// a JavaScript Engine peer!
+var ecmaGlobals =
+ [
+ "Array",
+ "ArrayBuffer",
+ "Boolean",
+ "DataView",
+ "Date",
+ "Error",
+ "EvalError",
+ "Float32Array",
+ "Float64Array",
+ "Function",
+ // NB: We haven't bothered to resolve constants like Infinity and NaN on
+ // Xrayed windows (which are seen from the XBL scope). We could support
+ // this if needed with some refactoring.
+ {name: "Infinity", xbl: false},
+ "Int16Array",
+ "Int32Array",
+ "Int8Array",
+ "InternalError",
+ {name: "Intl", android: false},
+ "Iterator",
+ "JSON",
+ "Map",
+ "Math",
+ {name: "NaN", xbl: false},
+ "Number",
+ "Object",
+ "Promise",
+ "Proxy",
+ "RangeError",
+ "ReferenceError",
+ "Reflect",
+ "RegExp",
+ "Set",
+ {name: "SharedArrayBuffer", release: false},
+ {name: "SIMD", nightly: true},
+ {name: "Atomics", release: false},
+ "StopIteration",
+ "String",
+ "Symbol",
+ "SyntaxError",
+ {name: "TypedObject", nightly: true},
+ "TypeError",
+ "Uint16Array",
+ "Uint32Array",
+ "Uint8Array",
+ "Uint8ClampedArray",
+ "URIError",
+ "WeakMap",
+ "WeakSet",
+ ];
+// 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,
+// except to remove items from it!
+//
+// This is a list of interfaces that were prefixed with 'moz' instead of 'Moz'.
+// We should never to that again, interfaces in the DOM start with an uppercase
+// letter. If you think you need to add an interface here, DON'T. Rename your
+// interface.
+var legacyMozPrefixedInterfaces =
+ [
+ "mozContact",
+ "mozRTCIceCandidate",
+ "mozRTCPeerConnection",
+ "mozRTCSessionDescription",
+ ];
+// IMPORTANT: Do not change the list above without review from a DOM peer,
+// except to remove items from it!
+
+// IMPORTANT: Do not change the list below without review from a DOM peer!
+var interfaceNamesInGlobalScope =
+ [
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AnalyserNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "Animation"},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "AnimationEffectReadOnly", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "AnimationEffectTiming", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "AnimationEffectTimingReadOnly", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AnimationEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "AnimationPlaybackEvent", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "AnimationTimeline", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Attr",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Audio",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioBuffer",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioContext",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioBufferSourceNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioDestinationNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioListener",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioParam",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioProcessingEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "AudioStreamTrack",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "BarProp",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "BatteryManager",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "BeforeUnloadEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "BiquadFilterNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Blob",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "BlobEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "BoxObject", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "BroadcastChannel",
+// 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!
+ "CanvasCaptureMediaStream",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CanvasGradient",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CanvasPattern",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CanvasRenderingContext2D",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CaretPosition",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CDATASection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ChannelMergerNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ChannelSplitterNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CharacterData",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "ChromeNodeList", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "ChromeWindow", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ClipboardEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CloseEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CommandEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Comment",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CompositionEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ConstantSourceNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Controllers",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ConvolverNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Crypto",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CryptoKey",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSS",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSS2Properties",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "CSSAnimation", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSConditionRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSCounterStyleRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSFontFaceRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSFontFeatureValuesRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSGroupingRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSImportRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSKeyframeRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSKeyframesRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSMediaRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSMozDocumentRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSNameSpaceRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSPageRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSPrimitiveValue",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "CSSPseudoElement", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSRuleList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSStyleDeclaration",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSStyleRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSStyleSheet",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSSupportsRule",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "CSSTransition", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSValue",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CSSValueList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CustomElementRegistry",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "CustomEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DataChannel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DataTransfer",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DataTransferItem",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DataTransferItemList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DelayNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DesktopNotification",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DesktopNotificationCenter",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DeviceLightEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DeviceMotionEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DeviceOrientationEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DeviceProximityEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceStorageAreaChangedEvent", desktop: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceStorageAreaListener", desktop: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceStorage", desktop: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "DeviceStorageChangeEvent", desktop: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Directory",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Document",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DocumentFragment",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "DocumentTimeline", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DocumentType",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "DOMConstructor", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMCursor",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMError",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMException",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMImplementation",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMMatrix",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMMatrixReadOnly",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMParser",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMPoint",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMPointReadOnly",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMQuad",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMRect",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMRectList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMRectReadOnly",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMRequest",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMStringList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMStringMap",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DOMTokenList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DragEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "DynamicsCompressorNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Element",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ErrorEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Event",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "EventSource",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "EventTarget",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "External",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "File",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FileList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FileReader",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FileSystem",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FileSystemDirectoryEntry",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FileSystemDirectoryReader",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FileSystemEntry",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FileSystemFileEntry",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FocusEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FormData",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FontFace",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FontFaceSet",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "FontFaceSetLoadEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "GainNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Gamepad",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "GamepadAxisMoveEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "GamepadButtonEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "GamepadButton",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "GamepadEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "GamepadPose", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HashChangeEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Headers",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "History",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLAllCollection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLAnchorElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLAppletElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLAreaElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLAudioElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLBaseElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLBodyElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLBRElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLButtonElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLCanvasElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLCollection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLContentElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLDataElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLDataListElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLDetailsElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLDirectoryElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLDivElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLDListElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLDocument",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLEmbedElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLFieldSetElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLFontElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLFormControlsCollection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLFormElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLFrameElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLFrameSetElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLHeadElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLHeadingElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLHRElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLHtmlElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLIFrameElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLImageElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLInputElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLLabelElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLLegendElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLLIElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLLinkElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLMapElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLMediaElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLMenuElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLMenuItemElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLMetaElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLMeterElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLModElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLObjectElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLOListElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLOptGroupElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLOptionElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLOptionsCollection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLOutputElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLParagraphElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLParamElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLPreElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLPictureElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLProgressElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLQuoteElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLScriptElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLSelectElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLShadowElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLSourceElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLSpanElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLStyleElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTableCaptionElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTableCellElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTableColElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTableElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTableRowElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTableSectionElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTemplateElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTextAreaElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTimeElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTitleElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLTrackElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLUListElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLUnknownElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "HTMLVideoElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "IdleDeadline", nightly: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBCursor",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBCursorWithValue",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBDatabase",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBFactory",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBFileHandle",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBFileRequest",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBIndex",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBKeyRange",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBMutableFile",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBObjectStore",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBOpenDBRequest",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBRequest",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBTransaction",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IDBVersionChangeEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "IIRFilterNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Image",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ImageBitmap",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ImageBitmapRenderingContext",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "ImageCapture", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "ImageCaptureErrorEvent", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ImageData",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "InputEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "InstallTrigger",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "IntersectionObserver", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "IntersectionObserverEntry", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "KeyEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "KeyboardEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "KeyframeEffectReadOnly", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "KeyframeEffect", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "LocalMediaStream",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Location",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaDeviceInfo",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaDevices",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaElementAudioSourceNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaError",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MediaKeyError", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MediaEncryptedEvent", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MediaKeys", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MediaKeySession", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MediaKeySystemAccess", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MediaKeyMessageEvent", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MediaKeyStatusMap", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaQueryList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaRecorder",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaSource",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaStream",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaStreamAudioDestinationNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaStreamAudioSourceNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaStreamEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaStreamTrackEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MediaStreamTrack",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "MenuBoxObject", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MessageChannel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MessageEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MessagePort",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MimeType",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MimeTypeArray",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MouseEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MouseScrollEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "mozRTCIceCandidate",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "mozRTCPeerConnection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "mozRTCSessionDescription",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MutationEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MutationObserver",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "MutationRecord",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "NamedNodeMap",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Navigator",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "NetworkInformation", desktop: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Node",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "NodeFilter",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "NodeIterator",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "NodeList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Notification",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "NotifyPaintEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "OffscreenCanvas", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "OfflineAudioCompletionEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "OfflineAudioContext",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "OfflineResourceList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Option",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "OscillatorNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PageTransitionEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PaintRequest",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PaintRequestList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PannerNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Path2D",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Performance",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PerformanceEntry",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PerformanceMark",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PerformanceMeasure",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PerformanceNavigation",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PerformanceObserver", nightly: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PerformanceObserverEntryList", nightly: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PerformanceResourceTiming",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PerformanceTiming",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PeriodicWave",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Permissions",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PermissionStatus",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Plugin",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PluginArray",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PointerEvent", nightly: true, desktop: true, disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PopStateEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PopupBlockedEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PopupBoxObject", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationDeviceInfoManager",
+ disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "Presentation", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationAvailability", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationConnection", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationConnectionAvailableEvent", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationConnectionClosedEvent", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationConnectionList", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationReceiver", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "PresentationRequest", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ProcessingInstruction",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ProgressEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RadioNodeList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Range",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RecordErrorEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Rect",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Request",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Response",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RGBColor",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCCertificate",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCDataChannelEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCDTMFSender",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCDTMFToneChangeEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCIceCandidate",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCPeerConnection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCPeerConnectionIceEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCRtpReceiver",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCRtpSender",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCSessionDescription",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCStatsReport",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "RTCTrackEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Screen",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ScreenOrientation",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ScriptProcessorNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ScrollAreaEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Selection",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SettingsLock",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ShadowRoot", // Bogus, but the test harness forces it on. See bug 1159768.
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SharedWorker",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SimpleGestureEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "SimpleTest", xbl: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SourceBuffer",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SourceBufferList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "SpeechSynthesisErrorEvent", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "SpeechSynthesisEvent", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "SpeechSynthesis", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "SpeechSynthesisUtterance", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "SpeechSynthesisVoice", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "SpecialPowers", xbl: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "StereoPannerNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Storage",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "StorageEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "StorageManager", nightly: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "StyleSheet",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "StyleSheetList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SubtleCrypto",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAngle",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedAngle",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedBoolean",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedEnumeration",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedInteger",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedLength",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedLengthList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedNumber",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedNumberList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedPreserveAspectRatio",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedRect",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedString",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimatedTransformList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimateElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimateMotionElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimateTransformElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGAnimationElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGCircleElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGClipPathElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGComponentTransferFunctionElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGDefsElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGDescElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGEllipseElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEBlendElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEColorMatrixElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEComponentTransferElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFECompositeElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEConvolveMatrixElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEDiffuseLightingElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEDisplacementMapElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEDistantLightElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEDropShadowElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEFloodElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEFuncAElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEFuncBElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEFuncGElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEFuncRElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEGaussianBlurElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEImageElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEMergeElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEMergeNodeElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEMorphologyElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEOffsetElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFEPointLightElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFESpecularLightingElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFESpotLightElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFETileElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFETurbulenceElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGFilterElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGForeignObjectElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGGElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGGradientElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGGraphicsElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGImageElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGLength",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGLengthList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGLinearGradientElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGLineElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGMarkerElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGMaskElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGMatrix",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGMetadataElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGMPathElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGNumber",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGNumberList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSeg",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegArcAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegArcRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegClosePath",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoCubicAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoCubicRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoCubicSmoothAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoCubicSmoothRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoQuadraticAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoQuadraticRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoQuadraticSmoothAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegCurvetoQuadraticSmoothRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegLinetoAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegLinetoHorizontalAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegLinetoHorizontalRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegLinetoRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegLinetoVerticalAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegLinetoVerticalRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegMovetoAbs",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPathSegMovetoRel",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPatternElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPoint",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPointList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPolygonElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPolylineElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGPreserveAspectRatio",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGRadialGradientElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGRect",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGRectElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGScriptElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGSetElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGStopElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGStringList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGStyleElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGSVGElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGSwitchElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGSymbolElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTextContentElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTextElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTextPathElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTextPositioningElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTitleElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTransform",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTransformList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGTSpanElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGUnitTypes",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGUseElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGViewElement",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGZoomAndPan",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "SVGZoomEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Text",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TextDecoder",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TextEncoder",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TextMetrics",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TextTrack",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TextTrackCue",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TextTrackCueList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TextTrackList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TimeEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TimeRanges",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Touch",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TouchEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TouchList",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TrackEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TransitionEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "TreeColumn", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "TreeColumns", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "TreeContentView", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "TreeSelection", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "TreeWalker",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "U2F", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "UIEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "URL",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "URLSearchParams",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "UserProximityEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "ValidityState",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "VideoPlaybackQuality",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "VideoStreamTrack",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VRDisplay", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VRDisplayCapabilities", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VREyeParameters", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VRFieldOfView", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VRFrameData", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VRPose", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VRStageParameters", release: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "VTTCue",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "VTTRegion", disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WaveShaperNode",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLActiveInfo",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLBuffer",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLContextEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLFramebuffer",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLProgram",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLQuery",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLRenderbuffer",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLRenderingContext",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGL2RenderingContext",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLSampler",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLShader",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLShaderPrecisionFormat",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLSync",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLTexture",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLTransformFeedback",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLUniformLocation",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebGLVertexArrayObject",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebKitCSSMatrix",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WebSocket",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "WheelEvent",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Window",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "Worker",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XMLDocument",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XMLHttpRequest",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XMLHttpRequestEventTarget",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XMLHttpRequestUpload",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XMLSerializer",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XMLStylesheetProcessingInstruction",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XPathEvaluator",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XPathExpression",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XPathResult",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "XSLTProcessor",
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULButtonElement", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULCheckboxElement", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULCommandDispatcher", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULCommandEvent", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULControlElement", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULControllers", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULDocument", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULElement", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULLabeledControlElement", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULPopupElement", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULTemplateBuilder", xbl: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "XULTreeBuilder", xbl: 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 createInterfaceMap(isXBLScope) {
+ var version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version;
+ var isNightly = version.endsWith("a1");
+ var isRelease = !version.includes("a");
+ var isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
+ var isMac = /Mac OS/.test(navigator.oscpu);
+ var isWindows = /Windows/.test(navigator.oscpu);
+ var isAndroid = navigator.userAgent.includes("Android");
+ var isLinux = /Linux/.test(navigator.oscpu) && !isAndroid;
+
+ var interfaceMap = {};
+
+ function addInterfaces(interfaces)
+ {
+ for (var entry of interfaces) {
+ if (typeof(entry) === "string") {
+ interfaceMap[entry] = true;
+ } else {
+ ok(!("pref" in entry), "Bogus pref annotation for " + entry.name);
+ if ((entry.nightly === !isNightly) ||
+ (entry.nightlyAndroid === !(isAndroid && isNightly) && isAndroid) ||
+ (entry.xbl === !isXBLScope) ||
+ (entry.desktop === !isDesktop) ||
+ (entry.windows === !isWindows) ||
+ (entry.mac === !isMac) ||
+ (entry.linux === !isLinux) ||
+ (entry.android === !isAndroid && !entry.nightlyAndroid) ||
+ (entry.release === !isRelease) ||
+ entry.disabled) {
+ interfaceMap[entry.name] = false;
+ } else {
+ interfaceMap[entry.name] = true;
+ }
+ }
+ }
+ }
+
+ addInterfaces(ecmaGlobals);
+ addInterfaces(interfaceNamesInGlobalScope);
+ if (isXBLScope) {
+ // We expose QueryInterface to XBL scopes. It's not an interface but we
+ // need to handle it because it's an own property of the global and the
+ // property name starts with an uppercase letter.
+ interfaceMap["QueryInterface"] = true;
+ }
+
+ return interfaceMap;
+}
+
+function runTest(isXBLScope) {
+ var interfaceMap = createInterfaceMap(isXBLScope);
+ for (var name of Object.getOwnPropertyNames(window)) {
+ // An interface name should start with an upper case character.
+ // However, we have a couple of legacy interfaces that start with 'moz', so
+ // we want to allow those until we can remove them.
+ if (!/^[A-Z]/.test(name) && legacyMozPrefixedInterfaces.indexOf(name) < 0) {
+ continue;
+ }
+ 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 the window (XBL: " + isXBLScope + ")? 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)");
+ delete interfaceMap[name];
+ }
+ for (var name of Object.keys(interfaceMap)) {
+ ok(name in window === interfaceMap[name],
+ name + " should " + (interfaceMap[name] ? "" : " NOT") + " be defined on the " + (isXBLScope ? "XBL" : "global") +" scope");
+ if (!interfaceMap[name]) {
+ delete interfaceMap[name];
+ }
+ }
+ if (isXBLScope) {
+ todo_is(Object.keys(interfaceMap).length, 0,
+ "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", "));
+ } else {
+ is(Object.keys(interfaceMap).length, 0,
+ "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", "));
+ }
+}
+
+runTest(false);
+SimpleTest.waitForExplicitFinish();
+
+</script>
+<span id="span" style="-moz-binding: url(file_interfaces.xml)"></span>
+</pre>
+</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 000000000..c131daca3
--- /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 type="application/javascript" 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 000000000..ef8853f64
--- /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 type="application/javascript" 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_offsets.css b/dom/tests/mochitest/general/test_offsets.css
new file mode 100644
index 000000000..18231c4d9
--- /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 000000000..2926ac447
--- /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 type="text/javascript" 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 000000000..509daff8c
--- /dev/null
+++ b/dom/tests/mochitest/general/test_offsets.js
@@ -0,0 +1,222 @@
+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];
+ testElement(element);
+ }
+
+ var nonappended = document.createElement("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 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") {
+ var lastchild = $("lastline");
+ scrollWidth = lastchild.getBoundingClientRect().width + paddingLeft + paddingRight;
+ var top = element.firstChild.getBoundingClientRect().top;
+ var bottom = element.lastChild.getBoundingClientRect().bottom;
+ var contentsHeight = bottom - top;
+ scrollHeight = contentsHeight + paddingTop + paddingBottom;
+ 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 (element instanceof SVGElement)
+ checkScrollState(element, 0, 0, 0, 0, element.id);
+ else
+ checkScrollState(element, 0, 0, scrollWidth, scrollHeight, element.id);
+ }
+
+ if (element instanceof SVGElement)
+ 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)
+ ok(Math.abs(element[type] - Math.round(val)) <= fuzz, testname + " " + type);
+}
+
+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 (element instanceof SVGElement)
+ 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 = (element instanceof SVGElement && (prop == "width" || prop == "height")) ?
+ element.getAttribute(prop) : getComputedStyle(element, "")[prop];
+ if (propVal == "auto")
+ return 0;
+ return parseFloat(propVal);
+}
diff --git a/dom/tests/mochitest/general/test_offsets.xul b/dom/tests/mochitest/general/test_offsets.xul
new file mode 100644
index 000000000..ff054dbca
--- /dev/null
+++ b/dom/tests/mochitest/general/test_offsets.xul
@@ -0,0 +1,99 @@
+<?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 type="text/javascript" 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" width="140" height="120"/>
+ </vbox>
+ <hbox align="start">
+ <vbox id="scrollbox" style="overflow: scroll; padding: 2px; margin: 3px; border: 4px solid green;"
+ maxwidth="66" maxheight="56">
+ <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.indexOf("Mac") >= 0) {
+ 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 000000000..e1636cd2a
--- /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 type="application/javascript" 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 000000000..e1274a259
--- /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 type="application/javascript" 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 000000000..0072e40b7
--- /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 type="text/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>
+<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/unicode", SpecialPowers.Ci.nsIClipboard.kSelectionClipboard) == "COPY TEXT") &&
+ SpecialPowers.getClipboardData("text/unicode", 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.indexOf("Mac") == -1 && navigator.platform.indexOf("Win") == -1, "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_now.html b/dom/tests/mochitest/general/test_performance_now.html
new file mode 100644
index 000000000..f062b6ee2
--- /dev/null
+++ b/dom/tests/mochitest/general/test_performance_now.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for High Resolution Timer</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" 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("untriaged");
+
+ // The spec says performance.now() should have micro-second resolution, but allows 1ms if the platform doesn't support it.
+ // Our implementation does provide micro-second resolution, except for windows XP combined with some HW properties
+ // where we can't use QueryPerformanceCounters (see comments at mozilla-central/xpcom/ds/TimeStamp_windows.cpp).
+ // This XP-low-res case results in about 15ms resolutions, and can be identified when perf.now() returns only integers.
+ //
+ // Since setTimeout might return too early/late, our goal is that perf.now() changed within 2ms
+ // (or 25ms for XP-low-res), rather than specific number of setTimeout(N) invocations.
+ // See bug 749894 (intermittent failures of this test)
+ var platformPossiblyLowRes = navigator.oscpu.indexOf("Windows NT 5.1") == 0; // XP only
+ var allInts = (n % 1) == 0; // Indicator of limited HW resolution.
+ var checks = 0;
+
+ function checkAfterTimeout() {
+ checks++;
+ var d2 = Date.now();
+ var n2 = window.performance.now();
+
+ allInts = allInts && (n2 % 1) == 0;
+ var lowResCounter = platformPossiblyLowRes && allInts;
+
+ if ( n2 == n && checks < 50 && // 50 is just a failsafe. Our real goals are 2ms or 25ms.
+ ( (d2 - d) < 2 // The spec allows 1ms resolution. We allow up to measured 2ms to ellapse.
+ ||
+ lowResCounter &&
+ (d2 - d) < 25
+ )
+ ) {
+ setTimeout(checkAfterTimeout, 1);
+ return;
+ }
+
+ // Loose spec: 1ms resolution, or 15ms resolution for the XP-low-res case.
+ // We shouldn't test that dt is actually within 2/25ms since the iterations break if it isn't, and timeout could be late.
+ ok(n2 > n, "Loose - the value of now() should increase within 2ms (or 25ms if low-res counter) (delta now(): " + (n2 - n) + " ms).");
+
+ // Strict spec: if it's not the XP-low-res case, while the spec allows 1ms resolution, it prefers microseconds, which we provide.
+ // Since the fastest setTimeout return which I observed was ~500 microseconds, a microseconds counter should change in 1 iteretion.
+ ok(n2 > n && (lowResCounter || checks == 1),
+ "Strict - [if high-res counter] the value of now() should increase after one setTimeout (hi-res: " + (!lowResCounter) +
+ ", iters: " + checks +
+ ", dt: " + (d2 - d) +
+ ", 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 000000000..0db8a19b4
--- /dev/null
+++ b/dom/tests/mochitest/general/test_performance_timeline.html
@@ -0,0 +1,36 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="application/javascript" 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],
+ ["dom.enable_user_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 000000000..f8cf818d8
--- /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 type="application/javascript" 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 000000000..491504aba
--- /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 type="application/javascript" 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 000000000..b9826a185
--- /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 type="text/javascript" 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 000000000..29c8f3e7e
--- /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 type="text/javascript" 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_resource_timing.html b/dom/tests/mochitest/general/test_resource_timing.html
new file mode 100644
index 000000000..febd9f5ca
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resource_timing.html
@@ -0,0 +1,38 @@
+<!--
+ 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 type="application/javascript" 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("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 000000000..9085d3121
--- /dev/null
+++ b/dom/tests/mochitest/general/test_resource_timing_cross_origin.html
@@ -0,0 +1,45 @@
+<!--
+ 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 type="application/javascript" 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]]}, 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_frameset.html b/dom/tests/mochitest/general/test_resource_timing_frameset.html
new file mode 100644
index 000000000..64f5ce71b
--- /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 type="application/javascript" 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_selectevents.html b/dom/tests/mochitest/general/test_selectevents.html
new file mode 100644
index 000000000..d510d19d0
--- /dev/null
+++ b/dom/tests/mochitest/general/test_selectevents.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Testing Selection Events</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ </head>
+
+ <body>
+ <iframe width="500"></iframe>
+ <script>
+ add_task(function* () {
+ // Push the correct preferences for the test
+ yield new Promise((done) => {
+ SpecialPowers.pushPrefEnv({'set': [['dom.select_events.enabled', true]]}, done);
+ });
+
+ // Start the actual test
+ yield 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.html b/dom/tests/mochitest/general/test_showModalDialog.html
new file mode 100644
index 000000000..511c79e63
--- /dev/null
+++ b/dom/tests/mochitest/general/test_showModalDialog.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=862918
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 862918</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 window.showModalDialog. **/
+
+ // The modal window needs to touch Cu, which means that it needs
+ // SpecialPowers. But given the semantics of modal windows, we have to
+ // do some funny stuff with postMessage to set this up.
+ window.onmessage = function(evt) {
+ is(evt.data, 'dosetup', "message from modal window is correct");
+ var win = SpecialPowers.wrap(evt.source);
+ win.wrappedJSObject.SpecialPowers = SpecialPowers;
+ SpecialPowers.setWrapped(win.wrappedJSObject, 'is', SpecialPowers.wrap(is));
+ SpecialPowers.setWrapped(win.wrappedJSObject, 'ok', SpecialPowers.wrap(ok));
+ win.wrappedJSObject.go();
+ };
+
+ var someObj = { foo: 42, bar: "hi"};
+ var xurl = location.toString()
+ .replace('mochi.test:8888', 'example.org')
+ .replace('test_showModal', 'file_showModal');
+ if (xurl.indexOf('?') != -1)
+ xurl = xurl.substring(0, xurl.indexOf('?'));
+ is(showModalDialog('file_showModalDialog.html'), "rv: undefined");
+ is(showModalDialog(xurl), undefined);
+ is(showModalDialog('file_showModalDialog.html', 3), "rv: 3");
+ is(showModalDialog(xurl, 3), undefined);
+ is(showModalDialog('file_showModalDialog.html', someObj), "rv: " + someObj);
+ is(showModalDialog(xurl, someObj), undefined);
+
+ // Test sequential navigations.
+ is(showModalDialog('file_showModalDialog.html?http://mochi.test:8888', 4),
+ 'rv: 4');
+ is(showModalDialog('file_showModalDialog.html?http://example.com', 4), undefined);
+ is(showModalDialog('file_showModalDialog.html?http://example.com,http://mochi.test:8888', 4), 'rv: 4');
+
+ // This test used to assert after gc. Make sure it doesn't.
+ SpecialPowers.gc();
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=862918">Mozilla Bug 862918</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_showModalDialog_e10s.html b/dom/tests/mochitest/general/test_showModalDialog_e10s.html
new file mode 100644
index 000000000..a3d9880c5
--- /dev/null
+++ b/dom/tests/mochitest/general/test_showModalDialog_e10s.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1077002
+-->
+<head>
+ <title>Test for showModalDialog unavailability in e10s</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=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;version=1.7">
+
+/** Test for showModalDialog unavailability in e10s **/
+
+// NB: This test runs in e10s only. In e10s showModalDialog should not
+// exist.
+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 000000000..03f840f3d
--- /dev/null
+++ b/dom/tests/mochitest/general/test_spacetopagedown.html
@@ -0,0 +1,76 @@
+<html>
+<head>
+ <meta charset="utf-8">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" 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;version=1.7">
+
+SimpleTest.waitForExplicitFinish();
+
+Components.utils.import("resource://gre/modules/Task.jsm");
+
+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()
+{
+ Task.async(function () {
+ yield pressKey(false);
+
+ ok(window.scrollY > 0, "Space with no focus" + window.scrollY);
+ yield pressKey(true);
+ is(window.scrollY, 0, "Shift+Space with no focus");
+
+ let checkbox = document.getElementById("checkbox");
+ checkbox.focus();
+ yield pressKey(false);
+
+ is(window.scrollY, 0, "Space with checkbox focused");
+ ok(checkbox.checked, "Space with checkbox focused, checked");
+ yield 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();
+ yield pressKey(false);
+ is(window.scrollY, 0, "Space with input focused");
+ is(input.value, " ", "Space with input focused, value");
+ yield 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 000000000..10bd43594
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsAccept.html
@@ -0,0 +1,42 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script type="text/javascript" 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(function* () {
+ yield setCookieBehavior(BEHAVIOR_ACCEPT);
+
+ // We should be able to access storage
+ yield storageAllowed();
+
+ // Same origin iframes should be allowed, unless they redirect to a URI with the null principal
+ yield runIFrame("frameStorageAllowed.html");
+ yield runIFrame("frameStorageNullprincipal.sjs");
+ yield 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');
+ yield runIFrame("frameStoragePrevented.html#nullprincipal");
+ yield runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // Thirdparty iframes should be allowed, unless they redirect to a URI with the null principal
+ yield runIFrame(thirdparty + "frameStorageAllowed.html");
+ yield runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ yield runIFrame(thirdparty + "frameStorageChrome.html?allowed=yes");
+
+ // Workers should be able to access storage
+ yield 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 000000000..36a752316
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsLimitForeign.html
@@ -0,0 +1,44 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script type="text/javascript" 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(function* () {
+ yield setCookieBehavior(BEHAVIOR_LIMIT_FOREIGN);
+
+ // We should be able to access storage
+ yield storageAllowed();
+
+ // Same origin iframes should be allowed.
+ yield runIFrame("frameStorageAllowed.html");
+ yield runIFrame("frameStorageChrome.html?allowed=yes");
+
+ // Null principal iframes should not.
+ yield runIFrame("frameStorageNullprincipal.sjs");
+
+ // Sandboxed iframes should have the null principal, and thus can't access storage
+ document.querySelector('iframe').setAttribute('sandbox', 'allow-scripts');
+ yield runIFrame("frameStoragePrevented.html#nullprincipal");
+ yield runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // Thirdparty iframes should be blocked, even when accessed from chrome over Xrays.
+ yield runIFrame(thirdparty + "frameStoragePrevented.html#thirdparty");
+ yield runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ yield runIFrame(thirdparty + "frameStorageChrome.html?allowed=no");
+
+ // Workers should be unable to access storage
+ yield 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 000000000..2a93f4d07
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsReject.html
@@ -0,0 +1,42 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script type="text/javascript" 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(function* () {
+ yield setCookieBehavior(BEHAVIOR_REJECT);
+
+ // We should be unable to access storage
+ yield storagePrevented();
+
+ // Same origin iframes should be blocked.
+ yield runIFrame("frameStoragePrevented.html");
+ yield runIFrame("frameStorageNullprincipal.sjs");
+ yield 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');
+ yield runIFrame("frameStoragePrevented.html#nullprincipal");
+ yield runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // thirdparty iframes should be blocked.
+ yield runIFrame(thirdparty + "frameStoragePrevented.html");
+ yield runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ yield runIFrame(thirdparty + "frameStorageChrome.html?allowed=no&blockSessionStorage=yes");
+
+ // Workers should be unable to access storage
+ yield 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 000000000..5ff3fc63f
--- /dev/null
+++ b/dom/tests/mochitest/general/test_storagePermissionsRejectForeign.html
@@ -0,0 +1,42 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Storage Permission Restrictions</title>
+
+ <script type="text/javascript" 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(function* () {
+ yield setCookieBehavior(BEHAVIOR_REJECT_FOREIGN);
+
+ // We should be able to access storage
+ yield storageAllowed();
+
+ // Same origin iframes should be allowed, unless they redirect to a URI with the null principal
+ yield runIFrame("frameStorageAllowed.html");
+ yield runIFrame("frameStorageNullprincipal.sjs");
+ yield 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');
+ yield runIFrame("frameStoragePrevented.html#nullprincipal");
+ yield runIFrame("frameStorageNullprincipal.sjs");
+ document.querySelector('iframe').removeAttribute('sandbox');
+
+ // thirdparty iframes should be blocked.
+ yield runIFrame(thirdparty + "frameStoragePrevented.html#thirdparty");
+ yield runIFrame(thirdparty + "frameStorageNullprincipal.sjs");
+ yield runIFrame(thirdparty + "frameStorageChrome.html?allowed=no");
+
+ // Workers should be able to access storage
+ yield 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 000000000..efafac250
--- /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 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 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_vibrator.html b/dom/tests/mochitest/general/test_vibrator.html
new file mode 100644
index 000000000..2874c783b
--- /dev/null
+++ b/dom/tests/mochitest/general/test_vibrator.html
@@ -0,0 +1,93 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Vibrator</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" 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;version=1.7">
+SimpleTest.waitForExplicitFinish();
+var result;
+function expectFailure(param) {
+ result = navigator.vibrate(param);
+ is(result, false, 'vibrate(' + param + ') should have failed.');
+}
+
+function expectSuccess(param) {
+ result = navigator.vibrate(param);
+ is(result, true, 'vibrate(' + param + ') must succeed.');
+}
+
+function tests(aEnabled) {
+ // Some edge cases that the bindings should handle for us.
+ expectSuccess(null);
+ expectSuccess(undefined);
+ // -1 will be converted to the highest unsigned long then clamped.
+ expectSuccess(-1);
+ expectSuccess('a');
+ // -1 will be converted to the highest unsigned long then clamped.
+ expectSuccess([100, -1]);
+ expectSuccess([100, 'a']);
+
+ var maxVibrateMs = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_ms');
+ var maxVibrateListLen = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_list_len');
+
+ // 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.
+ expectSuccess(maxVibrateMs + 1);
+ expectSuccess([maxVibrateMs + 1]);
+
+ var arr = [];
+ for (var i = 0; i < maxVibrateListLen + 1; i++) {
+ arr[i] = 0;
+ }
+ // The array will be truncated to have a length equal to dom.vibrator.max_vibrate_list_len.
+ expectSuccess(arr);
+
+
+ expectSuccess(0);
+ expectSuccess([]);
+ expectSuccess('1000');
+ expectSuccess(1000);
+ expectSuccess(1000.1);
+ expectSuccess([0, 0, 0]);
+ expectSuccess(['1000', 1000]);
+ expectSuccess([1000, 1000]);
+ expectSuccess([1000, 1000.1]);
+
+ // 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.");
+ if(!aEnabled)
+ SimpleTest.finish();
+}
+
+SpecialPowers.pushPermissions([
+ {type: 'vibration', allow: true, context: document}
+ ], function() {
+ // Test with the vibrator pref enabled.
+ SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', true]]}, function() {
+ tests(true);
+ SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', false]]}, tests(false));
+ });
+ // Everything should be the same when the vibrator is disabled -- in
+ // particular, a disabled vibrator shouldn't eat failures we'd otherwise
+ // observe.
+ }
+);
+
+</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 000000000..3f8028393
--- /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 type="text/javascript" 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 000000000..d27987beb
--- /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 type="application/javascript" 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/workerStorageAllowed.js b/dom/tests/mochitest/general/workerStorageAllowed.js
new file mode 100644
index 000000000..da76a7a0e
--- /dev/null
+++ b/dom/tests/mochitest/general/workerStorageAllowed.js
@@ -0,0 +1,61 @@
+// 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(false, "WORKER getting caches should not have thrown");
+}
+
+// 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 000000000..93a81eb75
--- /dev/null
+++ b/dom/tests/mochitest/general/workerStoragePrevented.js
@@ -0,0 +1,61 @@
+// 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(false, "WORKER getting caches should not have thrown");
+}
+
+// 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 000000000..1922074f1
--- /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/geolocation.html b/dom/tests/mochitest/geolocation/geolocation.html
new file mode 100644
index 000000000..e62f13e7d
--- /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 000000000..74a4bd34e
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/geolocation_common.js
@@ -0,0 +1,92 @@
+var harness = SimpleTest.harnessParameters.testRoot == "chrome" ? "chrome" : "tests";
+var BASE_URL = "http://mochi.test:8888/" + harness + "/dom/tests/mochitest/geolocation/network_geolocation.sjs";
+
+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)
+{
+ SpecialPowers.pushPrefEnv({"set": [["geo.wifi.uri", BASE_URL + "?action=respond-garbage"]]}, function() {
+ // we need to be sure that all location data has been purged/set.
+ sleep(1000);
+ callback.call();
+ });
+}
+
+function stop_sending_garbage(callback)
+{
+ SpecialPowers.pushPrefEnv({"set": [["geo.wifi.uri", BASE_URL + ""]]}, function() {
+ // we need to be sure that all location data has been purged/set.
+ sleep(1000);
+ callback.call();
+ });
+}
+
+function stop_geolocationProvider(callback)
+{
+ SpecialPowers.pushPrefEnv({"set": [["geo.wifi.uri", BASE_URL + "?action=stop-responding"]]}, function() {
+ // 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.wifi.debug.requestCache.enabled", enabled]]}, callback);
+}
+
+function worse_geolocationProvider(callback)
+{
+ SpecialPowers.pushPrefEnv({"set": [["geo.wifi.uri", BASE_URL + "?action=worse-accuracy"]]}, callback);
+}
+
+function resume_geolocationProvider(callback)
+{
+ SpecialPowers.pushPrefEnv({"set": [["geo.wifi.uri", BASE_URL + ""]]}, callback);
+}
+
+function delay_geolocationProvider(delay, callback)
+{
+ SpecialPowers.pushPrefEnv({"set": [["geo.wifi.uri", BASE_URL + "?delay=" + delay]]}, callback);
+}
+
+function send404_geolocationProvider(callback)
+{
+ set_network_request_cache_enabled(false, function() {
+ SpecialPowers.pushPrefEnv({"set": [["geo.wifi.uri", BASE_URL + "?action=send404"]]}, callback);});
+}
+
+function check_geolocation(location) {
+
+ ok(location, "Check to see if this location is non-null");
+
+ ok("timestamp" in location, "Check to see if there is a timestamp");
+
+ // eventually, coords may be optional (eg, when civic addresses are supported)
+ ok("coords" in location, "Check to see if this location has a coords");
+
+ var coords = location.coords;
+
+ ok("latitude" in coords, "Check to see if there is a latitude");
+ ok("longitude" in coords, "Check to see if there is a longitude");
+ ok("accuracy" in coords, "Check to see if there is a accuracy");
+
+ // optional ok("altitude" in coords, "Check to see if there is a altitude");
+ // optional ok("altitudeAccuracy" in coords, "Check to see if there is a alt accuracy");
+ // optional ok("heading" in coords, "Check to see if there is a heading");
+ // optional ok("speed" in coords, "Check to see if there is a speed");
+
+ ok (Math.abs(location.coords.latitude - 37.41857) < 0.001, "lat matches known value");
+ ok (Math.abs(location.coords.longitude + 122.08769) < 0.001, "lon matches known value");
+ // optional ok(location.coords.altitude == 42, "alt matches known value");
+ // optional ok(location.coords.altitudeAccuracy == 42, "alt acc matches known value");
+}
+
diff --git a/dom/tests/mochitest/geolocation/mochitest.ini b/dom/tests/mochitest/geolocation/mochitest.ini
new file mode 100644
index 000000000..1afcc31cb
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/mochitest.ini
@@ -0,0 +1,28 @@
+[DEFAULT]
+support-files =
+ geolocation.html
+ geolocation_common.js
+ network_geolocation.sjs
+ windowTest.html
+
+[test_allowCurrent.html]
+[test_allowWatch.html]
+[test_cachedPosition.html]
+[test_cancelCurrent.html]
+[test_cancelWatch.html]
+[test_clearWatch.html]
+[test_clearWatchBeforeAllowing.html]
+[test_clearWatch_invalid.html]
+[test_errorcheck.html]
+[test_geolocation_is_undefined_when_pref_is_off.html]
+[test_manyCurrentConcurrent.html]
+[test_manyCurrentSerial.html]
+[test_manyWatchConcurrent.html]
+[test_manyWatchSerial.html]
+[test_manyWindows.html]
+[test_optional_api_params.html]
+[test_shutdown.html]
+[test_timeoutCurrent.html]
+[test_timerRestartWatch.html]
+[test_windowClose.html]
+[test_worseAccuracyDoesNotBlockCallback.html]
diff --git a/dom/tests/mochitest/geolocation/network_geolocation.sjs b/dom/tests/mochitest/geolocation/network_geolocation.sjs
new file mode 100644
index 000000000..6c7ca47be
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/network_geolocation.sjs
@@ -0,0 +1,78 @@
+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/test_allowCurrent.html b/dom/tests/mochitest/geolocation/test_allowCurrent.html
new file mode 100644
index 000000000..30836fb7b
--- /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 type="text/javascript" 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 000000000..4084e43bb
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_allowWatch.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script type="text/javascript" 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);
+}
+</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 000000000..067bf205f
--- /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 type="text/javascript" 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">
+
+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 areTimesEqual(loc1, loc2) {
+ return loc1.timestamp === loc2.timestamp;
+}
+
+function test_cachedPosition() {
+ var cached = null;
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ // first call is just to warm up the cache
+
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ cached = pos;
+
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ ok(areTimesEqual(pos, cached), "position should be equal to cached position");
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ // force new position, can't be the one we have
+ ok(!areTimesEqual(pos, cached), "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 000000000..d71cfa350
--- /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 type="text/javascript" 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 000000000..493f412aa
--- /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 type="text/javascript" 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 000000000..85f81acd9
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_clearWatch.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=478911
+-->
+<head>
+ <title>Test for watchPosition and clearWatch</title>
+ <script type="text/javascript" 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 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);
+ if (hasBeenCleared == true) {
+ successWasCalledAfterClear = true;
+ }
+ if (firstCallback) {
+ SimpleTest.executeSoon(clearWatch);
+ firstCallback = false;
+ }
+}
+
+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 000000000..25b588959
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_clearWatchBeforeAllowing.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=886026
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script type="text/javascript" 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">
+
+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) {
+ successCallbackCalled = true;
+ }, function(err) {
+ errorCallbackCalled = true;
+ }
+ );
+
+ navigator.geolocation.getCurrentPosition(
+ function(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> \ No newline at end of file
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 000000000..0e2aed61c
--- /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 type="text/javascript" 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_errorcheck.html b/dom/tests/mochitest/geolocation/test_errorcheck.html
new file mode 100644
index 000000000..ffe5ce882
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_errorcheck.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=684722
+-->
+<head>
+ <title>Test for ErrorChecking </title>
+ <script type="text/javascript" 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) {
+ is(error.code,
+ SpecialPowers.Ci.nsIDOMGeoPositionError.POSITION_UNAVAILABLE, "Geolocation error handler fired");
+ 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_garbageWatch.html b/dom/tests/mochitest/geolocation/test_garbageWatch.html
new file mode 100644
index 000000000..167dc286e
--- /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 type="text/javascript" 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_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 000000000..882dacec3
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=884921
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script type="text/javascript" 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">
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv({set: [["geo.enabled", false]]}, function() {
+ is(navigator.geolocation, undefined);
+ is("geolocation" in navigator, false);
+ 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 000000000..19913d28b
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_handlerSpinsEventLoop.html
@@ -0,0 +1,72 @@
+<!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 type="text/javascript" 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.
+ */
+
+var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+
+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.wifi.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_manyCurrentConcurrent.html b/dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html
new file mode 100644
index 000000000..3fbccac53
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script type="text/javascript" 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 successCallbackCalled = 0;
+var failureCallbackCalled = 0;
+const totalResults = 100;
+
+function successCallback(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 000000000..3a0d96344
--- /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 type="text/javascript" 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 000000000..f1714e7ab
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script type="text/javascript" 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 successCallbackCalled = 0;
+var failureCallbackCalled = 0;
+const totalResults = 100;
+
+function successCallback(position) {
+ successCallbackCalled++;
+ testPassed();
+}
+
+function failureCallback(code) {
+ failureCallbackCalled++;
+ testPassed();
+}
+
+function test1() {
+ for (var x = 0; x < totalResults; x++)
+ navigator.geolocation.watchPosition(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_manyWatchSerial.html b/dom/tests/mochitest/geolocation/test_manyWatchSerial.html
new file mode 100644
index 000000000..bb166e7d2
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyWatchSerial.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script type="text/javascript" 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 watchID = 0;
+var completeCount = 10;
+
+
+function successCallback(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 000000000..a2e682ba1
--- /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 type="text/javascript" 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_optional_api_params.html b/dom/tests/mochitest/geolocation/test_optional_api_params.html
new file mode 100644
index 000000000..466024be5
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_optional_api_params.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=452566
+-->
+<head>
+ <title>Test for Bug 452566</title>
+ <script type="text/javascript" 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) {
+ exception = ex;
+ }
+ ok(exception, "Should have got an exception");
+
+ exception = null;
+ try {
+ navigator.geolocation.getCurrentPosition(function() {});
+ } catch(ex if ex instanceof TypeError) {
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.getCurrentPosition(function() {}, function() {});
+ } catch(ex if ex instanceof TypeError) {
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.getCurrentPosition(function() {}, function() {}, {});
+ } catch(ex if ex instanceof TypeError) {
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition();
+ } catch(ex if ex instanceof TypeError) {
+ exception = ex;
+ }
+ ok(exception, "Should have got an exception");
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition(function() {});
+ } catch(ex if ex instanceof TypeError) {
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition(function() {}, function() {});
+ } catch(ex if ex instanceof TypeError) {
+ exception = ex;
+ }
+ ok(!exception, exception);
+
+ exception = null;
+ try {
+ navigator.geolocation.watchPosition(function() {}, function() {}, {});
+ } catch(ex if ex instanceof TypeError) {
+ 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 000000000..a837ba30b
--- /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 type="text/javascript" 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 000000000..af6cab328
--- /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 type="text/javascript" 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 000000000..f51c0d53b
--- /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 type="text/javascript" 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 000000000..d24b54e0a
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_timerRestartWatch.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=526326
+-->
+<head>
+ <title>Test for watchPosition </title>
+ <script type="text/javascript" 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">
+
+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, "ensure error is a timeout.");
+ times++;
+
+ // 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");
+ // Now that we got a success callback, lets 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 000000000..bbb5c3f9f
--- /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 type="text/javascript" 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 000000000..b2339f888
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_worseAccuracyDoesNotBlockCallback.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=494924
+-->
+<head>
+ <title>Test for getCurrentPosition </title>
+ <script type="text/javascript" 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">
+
+SimpleTest.waitForExplicitFinish();
+
+resume_geolocationProvider(function() {
+ force_prompt(true, test1);
+});
+
+function successCallback2(position) {
+ check_geolocation(position);
+ SimpleTest.finish();
+}
+
+function successCallback1(position) {
+ check_geolocation(position);
+ 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 000000000..235a00639
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/windowTest.html
@@ -0,0 +1,40 @@
+<!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 type="text/javascript" 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">
+var finished = false;
+
+function successCallback(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/localstorage/chrome.ini b/dom/tests/mochitest/localstorage/chrome.ini
new file mode 100644
index 000000000..6cc5562c0
--- /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/frameChromeSlave.html b/dom/tests/mochitest/localstorage/frameChromeSlave.html
new file mode 100644
index 000000000..fd87702e9
--- /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 000000000..4bc4794e6
--- /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 000000000..de42e6bb9
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameLocalStorageCookieSettings.html
@@ -0,0 +1,20 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage cookies settings test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+
+</head>
+<body>
+<script type="text/javascript">
+ try {
+ localStorage.setItem("contentkey", "test-value");
+ ok(false, "Setting localStorageItem should throw a security exception");
+ } catch(ex) {
+ is(ex.name, "SecurityError");
+ }
+
+ finishTest();
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameLocalStorageSessionOnly.html b/dom/tests/mochitest/localstorage/frameLocalStorageSessionOnly.html
new file mode 100644
index 000000000..f6c7f0291
--- /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 000000000..4d83c4fef
--- /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 000000000..fef476bed
--- /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 000000000..3b3f0ebef
--- /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/frameQuota.html b/dom/tests/mochitest/localstorage/frameQuota.html
new file mode 100644
index 000000000..d3e32ad71
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameQuota.html
@@ -0,0 +1,105 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for sessionStorage test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+const DOM_QUOTA_REACHED = 2152924150;
+
+function checkException(func, exc)
+{
+ var exceptionThrew = false;
+ try {
+ func();
+ }
+ catch (ex) {
+ exceptionThrew = true;
+ is(ex.result, exc, "Expected "+exc+" exception");
+ }
+ ok(exceptionThrew, "Exception "+exc+" threw at "+location);
+}
+
+function doStep()
+{
+ var query = location.search.substring(1);
+ var queries = query.split("&");
+
+ var operation = queries[0];
+ var keyName = queries[1];
+ var result = queries[2];
+
+ switch (result)
+ {
+ case "success":
+ switch (operation)
+ {
+ case "add":
+ // Store 500 bytes long string must succeed
+ localStorage.setItem(keyName, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
+ is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "500 bytes key "+keyName+" stored");
+ break;
+
+ case "remove":
+ localStorage.removeItem(keyName);
+ is(localStorage.getItem(keyName), null, "Key "+keyName+" removed");
+ break;
+
+ case "checkclean":
+ is(localStorage.getItem(keyName), null, "Key "+keyName+" not present");
+ break;
+
+ case "checknotclean":
+ is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "Key "+keyName+" is present");
+ break;
+ }
+
+ break;
+
+ case "failure":
+ switch (operation)
+ {
+ case "add":
+ // Attempt to store 500 bytes long string that doens't
+ // fit the quota, have to throw DOM_QUOTA_REACHED exception
+ checkException(function() {
+ localStorage.setItem(keyName, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
+ }, DOM_QUOTA_REACHED);
+ is(localStorage.getItem(keyName), null, "500 bytes key "+keyName+" is NOT stored");
+ break;
+
+ case "add2":
+ // Attempt to change a key value to reach the DOM quota and
+ // check it fails and the old key value is still present.
+ checkException(function() {
+ localStorage.setItem(keyName, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
+ }, DOM_QUOTA_REACHED);
+ is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "Key "+keyName+" left unchanged");
+ break;
+ }
+
+ break;
+
+ default:
+ switch (operation)
+ {
+ case "clear":
+ localStorage.clear();
+ break;
+ }
+
+ break;
+ }
+
+ // Just inform the master we are finished now
+ postMsg("done");
+ return false;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameQuotaSessionOnly.html b/dom/tests/mochitest/localstorage/frameQuotaSessionOnly.html
new file mode 100644
index 000000000..a6f69b176
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/frameQuotaSessionOnly.html
@@ -0,0 +1,111 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>slave for sessionStorage test</title>
+
+<script type="text/javascript" src="interOriginFrame.js"></script>
+<script type="text/javascript">
+
+const DOM_QUOTA_REACHED = 2152924150;
+
+function checkException(func, exc)
+{
+ var exceptionThrew = false;
+ try {
+ func();
+ }
+ catch (ex) {
+ exceptionThrew = true;
+ is(ex.result, exc, "Expected "+exc+" exception");
+ }
+ ok(exceptionThrew, "Exception "+exc+" threw at "+location);
+}
+
+function doStep()
+{
+ var query = location.search.substring(1);
+ var queries = query.split("&");
+
+ var operation = queries[0];
+ var keyName = queries[1];
+ var result = queries[2];
+
+ switch (result)
+ {
+ case "success":
+ switch (operation)
+ {
+ case "add":
+ // Store 500 bytes long string must succeed
+ localStorage.setItem(keyName, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
+ is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "500 bytes key "+keyName+" stored");
+ break;
+
+ case "remove":
+ localStorage.removeItem(keyName);
+ is(localStorage.getItem(keyName), null, "Key "+keyName+" removed");
+ break;
+
+ case "checkclean":
+ is(localStorage.getItem(keyName), null, "Key "+keyName+" not present");
+ break;
+
+ case "checknotclean":
+ is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "Key "+keyName+" is present");
+ break;
+ }
+
+ break;
+
+ case "failure":
+ switch (operation)
+ {
+ case "add":
+ // Attempt to store 500 bytes long string that doens't
+ // fit the quota, have to throw DOM_QUOTA_REACHED exception
+ checkException(function() {
+ localStorage.setItem(keyName, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
+ }, DOM_QUOTA_REACHED);
+ is(localStorage.getItem(keyName), null, "500 bytes key "+keyName+" is NOT stored");
+ break;
+
+ case "add2":
+ // Attempt to change a key value to reach the DOM quota and
+ // check it fails and the old key value is still present.
+ checkException(function() {
+ localStorage.setItem(keyName, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
+ }, DOM_QUOTA_REACHED);
+ is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "Key "+keyName+" left unchanged");
+ break;
+ }
+
+ break;
+
+ case "":
+ default:
+ switch (operation)
+ {
+ case "clear":
+ localStorage.clear();
+ break;
+ }
+
+ break;
+ }
+
+ // Just inform the master we are finished now
+ postMsg("done");
+ return false;
+}
+
+function startTest() {
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, 'context': document}], function() {
+ postMsg('frame loaded');
+ });
+}
+</script>
+
+</head>
+
+<body onload="startTest();">
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/frameReplace.html b/dom/tests/mochitest/localstorage/frameReplace.html
new file mode 100644
index 000000000..145bfe8fc
--- /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 000000000..b64b8de10
--- /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 000000000..9daf9e9f7
--- /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 000000000..185ef8858
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/interOriginFrame.js
@@ -0,0 +1,57 @@
+function postMsg(message)
+{
+ parent.postMessage(message, "http://mochi.test:8888");
+}
+
+window.addEventListener("message", onMessageReceived, false);
+
+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 000000000..dcfac783a
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/interOriginTest.js
@@ -0,0 +1,42 @@
+var slaveLoadsPending = 1;
+
+var slaveOrigin = "";
+var slave = null;
+
+var failureRegExp = new RegExp("^FAILURE");
+const slavePath = "/tests/dom/tests/mochitest/localstorage/";
+
+window.addEventListener("message", onMessageReceived, false);
+
+function onMessageReceived(event)
+{
+ switch (event.data)
+ {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--slaveLoadsPending)
+ break;
+
+ // Just fall through...
+
+ // Indication of successfully finished step of a test
+ 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 000000000..e3f3c8771
--- /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, false);
+
+function onMessageReceived(event)
+{
+ switch (event.data)
+ {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--frameLoadsPending)
+ break;
+
+ // Just fall through...
+
+ // Indication of successfully finished step of a test
+ 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 000000000..5ca414067
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/localStorageCommon.js
@@ -0,0 +1,45 @@
+function localStorageFlush(cb)
+{
+ var ob = {
+ observe : function(sub, top, dat)
+ {
+ os().removeObserver(ob, "domstorage-test-flushed");
+ cb();
+ }
+ };
+ os().addObserver(ob, "domstorage-test-flushed", false);
+ notify("domstorage-test-flush-force");
+}
+
+function localStorageReload()
+{
+ notify("domstorage-test-reload");
+}
+
+function localStorageFlushAndReload(cb)
+{
+ localStorageFlush(function() {
+ localStorageReload();
+ cb();
+ });
+}
+
+function localStorageClearAll()
+{
+ os().notifyObservers(null, "cookie-changed", "cleared");
+}
+
+function localStorageClearDomain(domain)
+{
+ os().notifyObservers(null, "browser:purge-domain-data", domain);
+}
+
+function os()
+{
+ return SpecialPowers.Services.obs;
+}
+
+function notify(top)
+{
+ os().notifyObservers(null, top, null);
+}
diff --git a/dom/tests/mochitest/localstorage/mochitest.ini b/dom/tests/mochitest/localstorage/mochitest.ini
new file mode 100644
index 000000000..5242bf9b1
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/mochitest.ini
@@ -0,0 +1,52 @@
+[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
+
+[test_brokenUTF-16.html]
+[test_bug600307-DBOps.html]
+[test_bug746272-1.html]
+[test_bug746272-2.html]
+skip-if = os == "android" # bug 962029
+[test_cookieBlock.html]
+[test_cookieSession.html]
+[test_embededNulls.html]
+[test_keySync.html]
+[test_localStorageBase.html]
+skip-if = e10s
+[test_localStorageBaseSessionOnly.html]
+[test_localStorageCookieSettings.html]
+[test_localStorageEnablePref.html]
+[test_localStorageKeyOrder.html]
+[test_localStorageOriginsDiff.html]
+[test_localStorageOriginsDomainDiffs.html]
+[test_localStorageOriginsEquals.html]
+skip-if = toolkit == 'android'
+[test_localStorageOriginsPortDiffs.html]
+[test_localStorageOriginsSchemaDiffs.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_localStorageQuota.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_localStorageQuotaSessionOnly.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_localStorageQuotaSessionOnly2.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_localStorageReplace.html]
+skip-if = toolkit == 'android'
+[test_lowDeviceStorage.html]
+[test_storageConstructor.html]
+[test_localStorageSessionPrefOverride.html]
diff --git a/dom/tests/mochitest/localstorage/page_blank.html b/dom/tests/mochitest/localstorage/page_blank.html
new file mode 100644
index 000000000..157317d64
--- /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 000000000..d9648b271
--- /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 type="text/javascript" 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 000000000..8d539288b
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_bug600307-DBOps.html
@@ -0,0 +1,166 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>bug 600307</title>
+
+<script type="text/javascript" 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">
+
+/*
+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()
+{
+ // 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();
+ is(localStorage.length, 0, "localStorage clean in case 4");
+
+ if (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();
+ 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();
+ 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");
+ 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");
+ 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 000000000..d080fbf75
--- /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 type="text/javascript" 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 000000000..bb19b90c0
--- /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 type="text/javascript" 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 000000000..c95cbca49
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_cookieBlock.html
@@ -0,0 +1,42 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>cookie blocking test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ try {
+ localStorage.setItem("blocked", "blockedvalue");
+ ok(false, "Exception for localStorage.setItem, ACCESS_DENY");
+ }
+ catch (ex) {
+ ok(true, "Exception for localStorage.setItem, ACCESS_DENY");
+ }
+
+ try {
+ localStorage.getItem("blocked");
+ ok(false, "Exception for localStorage.getItem, ACCESS_DENY");
+ }
+ catch (ex) {
+ ok(true, "Exception for localStorage.getItem, ACCESS_DENY");
+ }
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': false, 'context': document}], startTest);
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_cookieSession.html b/dom/tests/mochitest/localstorage/test_cookieSession.html
new file mode 100644
index 000000000..1fdd6f4d5
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_cookieSession.html
@@ -0,0 +1,132 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>cookie per-session only test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+/*
+ Set cookie access to be just per session and store to the localStorage.
+ Content stored must prevail only for session of the browser, so it must
+ be accessible in another window we try to access that key in the same
+ storage.
+ */
+
+function pushCookie(aPermission, aNext) {
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': aPermission, 'context': document}], aNext);
+}
+
+function test1() {
+ localStorage.setItem("persistent1", "persistent value 1");
+ localStorage.setItem("persistent2", "persistent value 2");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, test1_b);
+}
+
+function test1_b() {
+ localStorage.setItem("session only", "session value");
+ parent.is(localStorage.getItem("session only"), "session value");
+ parent.is(localStorage.getItem("persistent1"), "persistent value 1");
+ parent.is(localStorage.getItem("persistent2"), "persistent value 2");
+
+ window.location.search = '?2';
+}
+
+function test2()
+{
+ parent.is(localStorage.getItem("session only"), "session value", "Value present when cookies in session-only mode");
+ parent.is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
+ parent.is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
+
+ localStorage.setItem("persistent1", "changed persistent value 1");
+ localStorage.removeItem("persistent2");
+
+ parent.is(localStorage.getItem("session only"), "session value", "Value present when cookies in session-only mode");
+ parent.is(localStorage.getItem("persistent1"), "changed persistent value 1", "Persistent value present");
+ parent.is(localStorage.getItem("persistent2"), null, "Persistent value removed");
+
+ // This clear has to delete only changes made in session only mode
+ localStorage.clear();
+
+ parent.is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
+ parent.is(localStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
+ parent.is(localStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
+
+ localStorage.setItem("session only 2", "must be deleted on drop of session-only cookies permissions");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT, function() { window.location.search = '?3'; });
+}
+
+function test3() {
+ parent.is(localStorage.getItem("session only"), null, "No value when cookies are in default mode");
+ parent.is(localStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
+ parent.is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
+ parent.is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, function() { window.location.search = '?4'; });
+}
+
+function test4() {
+ parent.is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
+ parent.is(localStorage.getItem("session only 2"), null, "Value not present when cookies in session-only mode after delete");
+ parent.is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present again");
+ parent.is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present again");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT, function() { window.location.search = '?5'; });
+}
+
+function test5() {
+ localStorage.clear();
+
+ parent.is(localStorage.getItem("session only"), null, "No value when cookies are in default mode");
+ parent.is(localStorage.getItem("persistent1"), null, "Persistent value not present after delete");
+ parent.is(localStorage.getItem("persistent2"), null, "Persistent value not present after delete");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, function() { window.location.search = '?6'; });
+}
+
+function test6() {
+ parent.is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
+ parent.is(localStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
+ parent.is(localStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
+ parent.is(localStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
+
+ parent.SimpleTest.finish();
+}
+
+function startTest() {
+ switch (location.search) {
+ case '?1':
+ test1();
+ break;
+ case '?2':
+ test2();
+ break;
+ case '?3':
+ test3();
+ break;
+ case '?4':
+ test4();
+ break;
+ case '?5':
+ test5();
+ break;
+ case '?6':
+ test6();
+ break;
+ default:
+ SimpleTest.waitForExplicitFinish();
+ var iframe = document.createElement('iframe');
+ iframe.src = 'test_cookieSession.html?1';
+ document.body.appendChild(iframe);
+ }
+}
+</script>
+
+</head>
+
+<body onload="startTest()">
+</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 000000000..04b88cfba
--- /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 type="text/javascript" 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 000000000..3f23945e2
--- /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 000000000..767a7d50c
--- /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 type="text/javascript" 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 > 0, "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 000000000..dbcf01fc2
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageBasePrivateBrowsing_perwindowpb.html
@@ -0,0 +1,263 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage basic test, while in sesison only mode</title>
+
+<script type="application/javascript" 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 Ci = Components.interfaces;
+var mainWindow;
+
+var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+prefBranch.setIntPref("browser.startup.page", 0);
+prefBranch.setCharPref("browser.startup.homepage_override.mstone", "ignore");
+
+function startTest() {
+ mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
+
+ 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 onLoad() {
+ win.removeEventListener("load", onLoad, false);
+ win.addEventListener("DOMContentLoaded", function onInnerLoad() {
+ if (win.content.location.href == "about:privatebrowsing") {
+ win.gBrowser.loadURI(contentPage);
+ return;
+ }
+ win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
+ SimpleTest.executeSoon(function() { aCallback(win); });
+ }, true);
+ win.gBrowser.loadURI(contentPage);
+ }, 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 000000000..c55a8e48d
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageBaseSessionOnly.html
@@ -0,0 +1,205 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage basic test, while in sesison only mode</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function startTest()
+{
+ 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 000000000..99f3b1ace
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html
@@ -0,0 +1,59 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage cookies settings test</title>
+
+<script type="text/javascript" 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>
+<iframe></iframe>
+
+<script type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+// Set cookies behavior to "always reject".
+SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 2]]},
+ test1);
+
+function test1() {
+ try {
+ localStorage.setItem("contentkey", "test-value");
+ ok(false, "Setting localStorageItem should throw a security exception");
+ }
+ catch(ex) {
+ is(ex.name, "SecurityError");
+ }
+
+ // Set cookies behavior to "reject 3rd party"
+ SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 1]],
+ "clear": [["network.cookie.lifetimePolicy"]]},
+ test3);
+}
+
+function test3() {
+ try {
+ 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 = document.querySelector("iframe");
+ myframe.src = fileTest;
+}
+
+// Called by interOriginTest.js
+function doNextTest() {
+ SimpleTest.finish();
+}
+
+</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 000000000..88fd81e0b
--- /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 type="text/javascript" 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");
+ ok(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 000000000..22665b008
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml
@@ -0,0 +1,58 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage basic test</title>
+
+<script type="text/javascript" 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()
+{
+ 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, "", null);
+ var principal = ssm.createCodebasePrincipal(uri, {});
+ var storage = dsm.createStorage(window, 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 000000000..ecc0af8ee
--- /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 type="text/javascript" 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 000000000..96a93171c
--- /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 000000000..c1a441772
--- /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 000000000..35cdd86b3
--- /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 000000000..d34e0dbcd
--- /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 000000000..57e4fb5ab
--- /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 000000000..6aeefe6bc
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuota.html
@@ -0,0 +1,111 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script type="text/javascript" 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:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.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 + "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;
+
+ // 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 + "frameQuota.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 + "frameQuota.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 + "frameQuota.html?add&C&success";
+ break;
+
+ case 8:
+ // 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:
+ // 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], ["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 000000000..24d3e4ba3
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html
@@ -0,0 +1,192 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script type="text/javascript" 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();
+
+Components.utils.import("resource://gre/modules/Services.jsm");
+
+const Ci = Components.interfaces;
+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;
+
+try {
+ quota = Services.prefs.getIntPref("dom.storage.default_quota");
+} catch (ex) {
+ quota = 5 * 1024;
+}
+Services.prefs.setIntPref("browser.startup.page", 0);
+Services.prefs.setIntPref("dom.storage.default_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)
+ }, false);
+ 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:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.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 + "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;
+
+ // 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 + "frameQuota.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 + "frameQuota.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 + "frameQuota.html?add&C&success";
+ break;
+
+ case 8:
+ // Do a clean up...
+ // TODO Bug 455070, use just ?clear what invokes call
+ // of clear() in the target frame. W/o clear method we must
+ // call clear implemented as removeItem for each item in
+ // the localStorage.
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear&A&";
+ break;
+
+ case 9:
+ // Do a clean up...
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear&B&";
+ break;
+
+ case 10:
+ // Do a clean up...
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuota.html?clear&C&";
+ break;
+
+ default:
+ Services.prefs.clearUserPref("browser.startup.page")
+ Services.prefs.setIntPref("dom.storage.default_quota", quota);
+ 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;
+ // Just fall through...
+ // Indication of successfully finished step of a test
+ 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(aWindow, aCallback) {
+ Services.obs.addObserver(function observer(aSubject, aTopic) {
+ if (aWindow == aSubject) {
+ Services.obs.removeObserver(observer, aTopic);
+ }
+
+ if (aWindow.content == null || aWindow.content.location.href != CONTENT_PAGE ) {
+ aWindow.addEventListener("DOMContentLoaded", function onInnerLoad() {
+ aWindow.removeEventListener("DOMContentLoaded", onInnerLoad, true);
+ SimpleTest.executeSoon(function() { aCallback(aWindow); });
+ }, true);
+
+ aWindow.gBrowser.loadURI(CONTENT_PAGE);
+ }
+ }, "browser-delayed-startup-finished", false);
+}
+
+function testOnWindow(aIsPrivate, callback) {
+ var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
+
+ var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
+ whenDelayedStartupFinished(win, function() { callback(win); });
+};
+</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 000000000..585da7ceb
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
@@ -0,0 +1,112 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script type="text/javascript" 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() {
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, 'context': document}], 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], ["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 000000000..1c1a70537
--- /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 type="text/javascript" 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], ["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 000000000..e1412eaef
--- /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 type="text/javascript" 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, false);
+
+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_localStorageSessionPrefOverride.html b/dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html
new file mode 100644
index 000000000..9fe6a48ec
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html
@@ -0,0 +1,54 @@
+<html>
+ <head>
+ <title>Local Storage Session Pref Override</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script>
+ const ACCEPT_SESSION = 2;
+
+ add_task(function*() {
+ yield new Promise((resolve, reject) => {
+ SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy",
+ ACCEPT_SESSION]]},
+ resolve);
+ });
+
+ // Before setting permission
+ yield new Promise((resolve) => {
+ var frame = document.createElement('iframe');
+ frame.src = "frameLocalStorageSessionOnly.html";
+
+ var listener = (e) => {
+ is(e.data, true, "Before adding permission should be session only");
+ window.removeEventListener('message', listener);
+ resolve();
+ };
+ window.addEventListener('message', listener);
+ document.body.appendChild(frame);
+ });
+
+ // After setting permission
+ yield new Promise((resolve) => {
+ SpecialPowers.pushPermissions([{"type": "cookie", "allow": 1, "context": document}],
+ resolve);
+ });
+
+ yield new Promise((resolve) => {
+ var frame = document.createElement('iframe');
+ frame.src = "frameLocalStorageSessionOnly.html";
+
+ var listener = (e) => {
+ is(e.data, false, "After adding permission should not be session only");
+ window.removeEventListener('message', listener);
+ resolve();
+ };
+ window.addEventListener('message', listener);
+ document.body.appendChild(frame);
+ });
+ });
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html b/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html
new file mode 100644
index 000000000..046587150
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html
@@ -0,0 +1,76 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Test localStorage usage while in a low device storage situation</title>
+
+<script type="text/javascript" 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">
+
+/*
+This test does the following:
+- Stores an item in localStorage.
+- Checks the stored value.
+- Emulates a low device storage situation.
+- Gets the stored item again.
+- Removes the stored item.
+- Fails storing a new value.
+- Emulates recovering from a low device storage situation.
+- Stores a new value.
+- Checks the stored value.
+*/
+
+function lowDeviceStorage(lowStorage) {
+ var data = lowStorage ? "full" : "free";
+ os().notifyObservers(null, "disk-space-watcher", data);
+}
+
+function startTest() {
+ // Add a test item.
+ localStorage.setItem("item", "value");
+ is(localStorage.getItem("item"), "value", "getItem()");
+
+ // Emulates a low device storage situation.
+ lowDeviceStorage(true);
+
+ // Checks that we can still access to the stored item.
+ is(localStorage.getItem("item"), "value",
+ "getItem() during a device storage situation");
+
+ // Removes the stored item.
+ localStorage.removeItem("item");
+ is(localStorage.getItem("item"), null,
+ "getItem() after removing the item");
+
+ // Fails storing a new item.
+ try {
+ localStorage.setItem("newItem", "value");
+ ok(false, "Storing a new item is expected to fail");
+ } catch(e) {
+ ok(true, "Got an expected exception " + e);
+ } finally {
+ is(localStorage.getItem("newItem"), null,
+ "setItem while device storage is low");
+ }
+
+ // Emulates recovering from a low device storage situation.
+ lowDeviceStorage(false);
+
+ // Add a test item after recovering from the low device storage situation.
+ localStorage.setItem("newItem", "value");
+ is(localStorage.getItem("newItem"), "value",
+ "getItem() with available storage");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+</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 000000000..f77c80ae2
--- /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 type="text/javascript" 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/notification/MockServices.js b/dom/tests/mochitest/notification/MockServices.js
new file mode 100644
index 000000000..f809b2438
--- /dev/null
+++ b/dom/tests/mochitest/notification/MockServices.js
@@ -0,0 +1,117 @@
+var MockServices = (function () {
+ "use strict";
+
+ const MOCK_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components)
+ .ID("{48068bc2-40ab-4904-8afd-4cdfb3a385f3}");
+ const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
+
+ const MOCK_SYSTEM_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components)
+ .ID("{e86d888c-e41b-4b78-9104-2f2742a532de}");
+ const SYSTEM_ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/system-alerts-service;1";
+
+ var registrar = SpecialPowers.wrap(SpecialPowers.Components).manager
+ .QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar);
+
+ var activeAlertNotifications = Object.create(null);
+
+ var activeAppNotifications = Object.create(null);
+
+ window.addEventListener('mock-notification-close-event', function(e) {
+ for (var alertName in activeAlertNotifications) {
+ var notif = activeAlertNotifications[alertName];
+ if (notif.title === e.detail.title) {
+ notif.listener.observe(null, "alertfinished", null);
+ delete activeAlertNotifications[alertName];
+ delete activeAppNotifications[alertName];
+ return;
+ }
+ }
+ });
+
+ var mockAlertsService = {
+ showPersistentNotification: function(persistentData, alert, alertListener) {
+ this.showAlert(alert, alertListener);
+ },
+
+ showAlert: function(alert, alertListener) {
+ var listener = SpecialPowers.wrap(alertListener);
+ activeAlertNotifications[alert.name] = {
+ listener: listener,
+ cookie: alert.cookie,
+ title: alert.title
+ };
+
+ // fake async alert show event
+ if (listener) {
+ setTimeout(function () {
+ listener.observe(null, "alertshow", alert.cookie);
+ }, 100);
+ setTimeout(function () {
+ listener.observe(null, "alertclickcallback", alert.cookie);
+ }, 100);
+ }
+ },
+
+ showAlertNotification: function(imageUrl, title, text, textClickable,
+ cookie, alertListener, name) {
+ this.showAlert({
+ name: name,
+ cookie: cookie,
+ title: title
+ }, alertListener);
+ },
+
+ closeAlert: function(name) {
+ var alertNotification = activeAlertNotifications[name];
+ if (alertNotification) {
+ if (alertNotification.listener) {
+ alertNotification.listener.observe(null, "alertfinished", alertNotification.cookie);
+ }
+ delete activeAlertNotifications[name];
+ }
+
+ var appNotification = activeAppNotifications[name];
+ if (appNotification) {
+ delete activeAppNotifications[name];
+ }
+ },
+
+ QueryInterface: function(aIID) {
+ if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
+ SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) {
+ return this;
+ }
+ throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
+ },
+
+ createInstance: function(aOuter, aIID) {
+ if (aOuter != null) {
+ throw SpecialPowers.Components.results.NS_ERROR_NO_AGGREGATION;
+ }
+ return this.QueryInterface(aIID);
+ }
+ };
+ mockAlertsService = SpecialPowers.wrapCallbackObject(mockAlertsService);
+
+ // MockServices API
+ return {
+ register: function () {
+ registrar.registerFactory(MOCK_ALERTS_CID, "alerts service",
+ ALERTS_SERVICE_CONTRACT_ID,
+ mockAlertsService);
+
+ registrar.registerFactory(MOCK_SYSTEM_ALERTS_CID, "system alerts service",
+ SYSTEM_ALERTS_SERVICE_CONTRACT_ID,
+ mockAlertsService);
+ },
+
+ unregister: function () {
+ registrar.unregisterFactory(MOCK_ALERTS_CID, mockAlertsService);
+ registrar.unregisterFactory(MOCK_SYSTEM_ALERTS_CID, mockAlertsService);
+ },
+
+ activeAlertNotifications: activeAlertNotifications,
+
+ activeAppNotifications: activeAppNotifications,
+ };
+})();
diff --git a/dom/tests/mochitest/notification/NotificationTest.js b/dom/tests/mochitest/notification/NotificationTest.js
new file mode 100644
index 000000000..f17dc1d49
--- /dev/null
+++ b/dom/tests/mochitest/notification/NotificationTest.js
@@ -0,0 +1,136 @@
+var NotificationTest = (function () {
+ "use strict";
+
+ function info(msg, name) {
+ SimpleTest.info("::Notification Tests::" + (name || ""), msg);
+ }
+
+ function setup_testing_env() {
+ SimpleTest.waitForExplicitFinish();
+ // turn on testing pref (used by notification.cpp, and mock the alerts
+ SpecialPowers.setBoolPref("notification.prompt.testing", true);
+ }
+
+ function teardown_testing_env() {
+ SimpleTest.finish();
+ }
+
+ function executeTests(tests, callback) {
+ // context is `this` object in test functions
+ // it can be used to track data between tests
+ var context = {};
+
+ (function executeRemainingTests(remainingTests) {
+ if (!remainingTests.length) {
+ return callback();
+ }
+
+ var nextTest = remainingTests.shift();
+ var finishTest = executeRemainingTests.bind(null, remainingTests);
+ var startTest = nextTest.call.bind(nextTest, context, finishTest);
+
+ try {
+ startTest();
+ // if no callback was defined for test function,
+ // we must manually invoke finish to continue
+ if (nextTest.length === 0) {
+ finishTest();
+ }
+ } catch (e) {
+ ok(false, "Test threw exception!");
+ finishTest();
+ }
+ })(tests);
+ }
+
+ var fakeCustomData = (function () {
+ var buffer = new ArrayBuffer(2);
+ var dv = new DataView(buffer).setInt16(0, 42, true);
+ var canvas = document.createElement("canvas");
+ canvas.width = canvas.height = 100;
+ var context = canvas.getContext("2d");
+
+ var map = new Map();
+ var set = new Set();
+ map.set("test", 42);
+ set.add(4); set.add(2);
+
+ return {
+ primitives: {
+ a: 123,
+ b: "test",
+ c: true,
+ d: [1, 2, 3]
+ },
+ date: new Date(2013, 2, 1, 1, 10),
+ regexp: new RegExp("[^.]+"),
+ arrayBuffer: buffer,
+ imageData: context.createImageData(100, 100),
+ map: map,
+ set: set
+ };
+ })();
+
+ // NotificationTest API
+ return {
+ run: function (tests, callback) {
+ setup_testing_env();
+
+ addLoadEvent(function () {
+ executeTests(tests, function () {
+ teardown_testing_env();
+ callback && callback();
+ });
+ });
+ },
+
+ allowNotifications: function () {
+ SpecialPowers.setBoolPref("notification.prompt.testing.allow", true);
+ },
+
+ denyNotifications: function () {
+ SpecialPowers.setBoolPref("notification.prompt.testing.allow", false);
+ },
+
+ clickNotification: function (notification) {
+ // TODO: how??
+ },
+
+ fireCloseEvent: function (title) {
+ window.dispatchEvent(new CustomEvent("mock-notification-close-event", {
+ detail: {
+ title: title
+ }
+ }));
+ },
+
+ info: info,
+
+ customDataMatches: function(dataObj) {
+ var url = "http://www.domain.com";
+ try {
+ return (JSON.stringify(dataObj.primitives) ===
+ JSON.stringify(fakeCustomData.primitives)) &&
+ (dataObj.date.toDateString() ===
+ fakeCustomData.date.toDateString()) &&
+ (dataObj.regexp.exec(url)[0].substr(7) === "www") &&
+ (new Int16Array(dataObj.arrayBuffer)[0] === 42) &&
+ (JSON.stringify(dataObj.imageData.data) ===
+ JSON.stringify(fakeCustomData.imageData.data)) &&
+ (dataObj.map.get("test") == 42) &&
+ (dataObj.set.has(4) && dataObj.set.has(2));
+ } catch(e) {
+ return false;
+ }
+ },
+
+ payload: {
+ body: "Body",
+ tag: "fakeTag",
+ icon: "icon.jpg",
+ lang: "en-US",
+ dir: "ltr",
+ data: fakeCustomData
+ }
+ };
+})();
diff --git a/dom/tests/mochitest/notification/desktop-notification/create_notification.html b/dom/tests/mochitest/notification/desktop-notification/create_notification.html
new file mode 100644
index 000000000..b0387e4ff
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/create_notification.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head><meta charset=utf-8>
+ <title>Create a notification</title>
+</head>
+<body>
+<script>
+
+var notification = new Notification("This is a title", {
+ body: "This is a notification body",
+ tag: "sometag",
+ });
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/notification/desktop-notification/moz.build b/dom/tests/mochitest/notification/desktop-notification/moz.build
new file mode 100644
index 000000000..28919c271
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/moz.build
@@ -0,0 +1,6 @@
+# -*- 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/.
+
diff --git a/dom/tests/mochitest/notification/desktop-notification/notification_common.js b/dom/tests/mochitest/notification/desktop-notification/notification_common.js
new file mode 100644
index 000000000..921b1e753
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/notification_common.js
@@ -0,0 +1,70 @@
+const MOCK_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{48068bc2-40ab-4904-8afd-4cdfb3a385f3}");
+const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
+
+const MOCK_SYSTEM_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{e86d888c-e41b-4b78-9104-2f2742a532de}");
+const SYSTEM_ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/system-alerts-service;1";
+
+var registrar = SpecialPowers.wrap(SpecialPowers.Components).manager.
+ QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar);
+
+var mockAlertsService = {
+ showAlert: function(alert, alertListener) {
+ // probably should do this async....
+ SpecialPowers.wrap(alertListener).observe(null, "alertshow", alert.cookie);
+
+ if (SpecialPowers.getBoolPref("notification.prompt.testing.click_on_notification") == true) {
+ SpecialPowers.wrap(alertListener).observe(null, "alertclickcallback", alert.cookie);
+ }
+
+ SpecialPowers.wrap(alertListener).observe(null, "alertfinished", alert.cookie);
+ },
+
+ showAlertNotification: function(imageUrl, title, text, textClickable,
+ cookie, alertListener, name, bidi,
+ lang, data) {
+ return this.showAlert({
+ cookie: cookie
+ }, alertListener);
+ },
+
+ QueryInterface: function(aIID) {
+ if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
+ SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) {
+ return this;
+ }
+ throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
+ },
+
+ createInstance: function(aOuter, aIID) {
+ if (aOuter != null) {
+ throw SpecialPowers.Components.results.NS_ERROR_NO_AGGREGATION;
+ }
+ return this.QueryInterface(aIID);
+ }
+};
+mockAlertsService = SpecialPowers.wrapCallbackObject(mockAlertsService);
+
+function setup_notifications(allowPrompt, forceClick, callback) {
+ SpecialPowers.pushPrefEnv({'set': [["notification.prompt.testing", true],
+ ["notification.prompt.testing.allow", allowPrompt],
+ ["notification.prompt.testing.click_on_notification", forceClick]]},
+ callback);
+
+ registrar.registerFactory(MOCK_SYSTEM_ALERTS_CID, "system alerts service",
+ SYSTEM_ALERTS_SERVICE_CONTRACT_ID,
+ mockAlertsService);
+
+ registrar.registerFactory(MOCK_ALERTS_CID, "alerts service",
+ ALERTS_SERVICE_CONTRACT_ID,
+ mockAlertsService);
+}
+
+function reset_notifications() {
+ registrar.unregisterFactory(MOCK_SYSTEM_ALERTS_CID, mockAlertsService);
+ registrar.unregisterFactory(MOCK_ALERTS_CID, mockAlertsService);
+}
+
+function is_feature_enabled() {
+ return navigator.mozNotification && SpecialPowers.getBoolPref("notification.feature.enabled");
+}
+
diff --git a/dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html b/dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html
new file mode 100644
index 000000000..75f3c84b4
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=573588
+-->
+<head>
+ <title>Basic functional test</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="notification_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=573588">Basic property tests</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+<script type="text/javascript">
+ if (is_feature_enabled()) {
+ SimpleTest.waitForExplicitFinish();
+
+ function showNotifications() {
+ ok(navigator.mozNotification, "test for notification.");
+
+ var notification = navigator.mozNotification.createNotification("test", "test");
+ ok(notification, "test to ensure we can create a notification");
+
+ notification.onclose = function() {
+ ok(true, "notification was display and is now closing");
+ reset_notifications();
+ SimpleTest.finish();
+ };
+
+ notification.onclick = function() {
+ ok(false, "Click should not have been called.");
+ reset_notifications();
+ SimpleTest.finish();
+ };
+
+ notification.show();
+ }
+
+ setup_notifications(true, false, showNotifications);
+ } else {
+ ok(true, "Desktop notifications not enabled.");
+ }
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/notification/desktop-notification/test_basic_notification_click.html b/dom/tests/mochitest/notification/desktop-notification/test_basic_notification_click.html
new file mode 100644
index 000000000..defa0f412
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/test_basic_notification_click.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=573588
+-->
+<head>
+ <title>Basic functional test</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="notification_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=573588">Basic property tests</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+<script type="text/javascript">
+ if (is_feature_enabled()) {
+ SimpleTest.waitForExplicitFinish();
+
+ var click_was_called = false;
+
+ function showNotifications() {
+ ok(navigator.mozNotification, "test for notification.");
+
+ var notification = navigator.mozNotification.createNotification("test", "test");
+ ok(notification, "test to ensure we can create a notification");
+
+ notification.onclose = function() {
+ ok(true, "notification was display and is now closing");
+ ok(click_was_called, "was notification clicked?");
+
+ reset_notifications();
+ SimpleTest.finish();
+ };
+
+ notification.onclick = function() {
+ ok(true, "Click was called. Good.");
+ click_was_called = true;
+ };
+
+ notification.show();
+ }
+
+ setup_notifications(true, true, showNotifications);
+ } else {
+ ok(true, "Desktop notifications not enabled.");
+ }
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/notification/desktop-notification/test_leak_windowClose.html b/dom/tests/mochitest/notification/desktop-notification/test_leak_windowClose.html
new file mode 100644
index 000000000..c0c9699ae
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/test_leak_windowClose.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=605309
+-->
+<head>
+ <title>Test for leak when window closes</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="notification_common.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script>
+if (is_feature_enabled()) {
+ SimpleTest.waitForExplicitFinish();
+
+ function boom()
+ {
+ document.documentElement.focus();
+ var x = navigator.mozNotification;
+ document.documentElement.addEventListener('', function(){x}, false);
+ ok(true, "load callback called");
+ SimpleTest.finish();
+ }
+
+ window.addEventListener("load", boom, false);
+} else {
+ ok(true, "Desktop notifications not enabled.");
+}
+</script>
+</head>
+<body>
+<p> I like to write tests </p>
+</body>
+</html>
diff --git a/dom/tests/mochitest/notification/desktop-notification/test_notification_tag.html b/dom/tests/mochitest/notification/desktop-notification/test_notification_tag.html
new file mode 100644
index 000000000..37bcb16c0
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/test_notification_tag.html
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=782211
+-->
+<head>
+ <title>Bug 782211</title>
+ <script type="text/javascript" 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=782211">Bug 782211</a>
+<p id="display"></p>
+<iframe name="sameDomain"></iframe>
+<iframe name="anotherSameDomain"></iframe>
+<iframe name="crossDomain"></iframe>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+<script type="text/javascript">
+ const MOCK_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{dbe37e64-d9a3-402c-8d8a-0826c619f7ad}");
+ const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
+
+ var mockAlertsService = {
+ showAlert: function(alert, alertListener) {
+ notificationsCreated.push(alert.name);
+ if (notificationsCreated.length == 3) {
+ checkNotifications();
+ }
+ },
+
+ showAlertNotification: function(imageUrl, title, text, textClickable,
+ cookie, alertListener, name, dir,
+ lang, data) {
+ this.showAlert({ name: name });
+ },
+
+ QueryInterface: function(aIID) {
+ if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
+ SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) {
+ return this;
+ }
+ throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
+ },
+
+ createInstance: function(aOuter, aIID) {
+ if (aOuter != null) {
+ throw SpecialPowers.Components.results.NS_ERROR_NO_AGGREGATION;
+ }
+ return this.QueryInterface(aIID);
+ }
+ };
+ mockAlertsService = SpecialPowers.wrapCallbackObject(mockAlertsService);
+
+ var notificationsCreated = [];
+ function checkNotifications() {
+ // notifications created by the test1 origin
+ var test1notifications = [];
+ // notifications created by the test2 origin
+ var test2notifications = [];
+ for (var i = 0; i < notificationsCreated.length; i++) {
+ var notificationName = notificationsCreated[i];
+ if (notificationName.indexOf("test1") !== -1) {
+ test1notifications.push(notificationsCreated[i]);
+ } else if (notificationName.indexOf("test2") !== -1) {
+ test2notifications.push(notificationsCreated[i]);
+ }
+ }
+
+ is(test1notifications.length, 2, "2 notifications should be created by test1.example.org:80 origin.");
+ is(test1notifications[0], test1notifications[1], "notification names should be identical.");
+ is(test2notifications.length, 1, "1 notification should be created by test2.example.org:80 origin.");
+
+ // Register original alerts service.
+ SpecialPowers.wrap(SpecialPowers.Components).
+ manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar).
+ unregisterFactory(MOCK_CID, mockAlertsService);
+
+ SimpleTest.finish();
+ }
+
+ if (window.Notification) {
+ SimpleTest.waitForExplicitFinish();
+
+ function showNotifications() {
+ SpecialPowers.wrap(SpecialPowers.Components).
+ manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar).
+ registerFactory(MOCK_CID, "alerts service", ALERTS_SERVICE_CONTRACT_ID, mockAlertsService);
+
+ // Load two frames with the same origin that create notification with the same tag.
+ // Both pages should generate notifications with the same name, and thus the second
+ // notification should replace the first.
+ frames["sameDomain"].location.href = "http://test1.example.org:80/tests/dom/tests/mochitest/notification/create_notification.html";
+ frames["anotherSameDomain"].location.href = "http://test1.example.org:80/tests/dom/tests/mochitest/notification/create_notification.html";
+
+ // Load a frame with a different origin that creates a notification with the same tag.
+ // The notification name should be different and thus no notifications should be replaced.
+ frames["crossDomain"].location.href = "http://test2.example.org:80/tests/dom/tests/mochitest/notification/create_notification.html";
+ }
+
+ SpecialPowers.pushPrefEnv({'set': [["notification.prompt.testing", true],
+ ["notification.prompt.testing.allow", true]]},
+ showNotifications);
+ } else {
+ ok(true, "Notifications are not enabled on the platform.");
+ }
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/notification/desktop-notification/test_system_principal.xul b/dom/tests/mochitest/notification/desktop-notification/test_system_principal.xul
new file mode 100644
index 000000000..1690bc101
--- /dev/null
+++ b/dom/tests/mochitest/notification/desktop-notification/test_system_principal.xul
@@ -0,0 +1,85 @@
+<?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=874090
+-->
+<window title="Mozilla Bug 874090" onload="runTests()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" 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=874090"
+ target="_blank">Mozilla Bug 874090</a>
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 874090 **/
+ const MOCK_CID = Components.ID("{2a0f83c4-8818-4914-a184-f1172b4eaaa7}");
+ const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
+
+ var mockAlertsService = {
+ showAlert: function(alert, alertListener) {
+ ok(true, "System principal was granted permission and is able to call showAlert.");
+ unregisterMock();
+ SimpleTest.finish();
+ },
+
+ showAlertNotification: function(imageUrl, title, text, textClickable,
+ cookie, alertListener, name, dir, lang, data) {
+ this.showAlert();
+ },
+
+ QueryInterface: function(aIID) {
+ if (aIID.equals(Components.interfaces.nsISupports) ||
+ aIID.equals(Components.interfaces.nsIAlertsService)) {
+ return this;
+ }
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ },
+
+ createInstance: function(aOuter, aIID) {
+ if (aOuter != null) {
+ throw Components.results.NS_ERROR_NO_AGGREGATION;
+ }
+ return this.QueryInterface(aIID);
+ }
+ };
+
+ function registerMock() {
+ Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
+ registerFactory(MOCK_CID, "alerts service", ALERTS_SERVICE_CONTRACT_ID, mockAlertsService);
+ }
+
+ function unregisterMock() {
+ Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
+ unregisterFactory(MOCK_CID, mockAlertsService);
+ }
+
+ function runTests() {
+ registerMock();
+
+ is(Notification.permission, "granted", "System principal should be automatically granted permission.");
+
+ Notification.requestPermission(function(permission) {
+ is(permission, "granted", "System principal should be granted permission when calling requestPermission.");
+
+ if (permission == "granted") {
+ // Create a notification and make sure that it is able to call into
+ // the mock alert service to show the notification.
+ new Notification("Hello");
+ } else {
+ unregisterMock();
+ SimpleTest.finish();
+ }
+ });
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ ]]>
+ </script>
+</window>
diff --git a/dom/tests/mochitest/notification/mochitest.ini b/dom/tests/mochitest/notification/mochitest.ini
new file mode 100644
index 000000000..c0de5ed46
--- /dev/null
+++ b/dom/tests/mochitest/notification/mochitest.ini
@@ -0,0 +1,10 @@
+[DEFAULT]
+
+support-files =
+ MockServices.js
+ NotificationTest.js
+
+[test_notification_basics.html]
+[test_notification_storage.html]
+[test_bug931307.html]
+skip-if = (os == 'android') # Bug 1258975 on android.
diff --git a/dom/tests/mochitest/notification/test_bug931307.html b/dom/tests/mochitest/notification/test_bug931307.html
new file mode 100644
index 000000000..bd31c7061
--- /dev/null
+++ b/dom/tests/mochitest/notification/test_bug931307.html
@@ -0,0 +1,34 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+ <title>Bug 931307</title>
+ <script type="application/javascript" 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();
+var notification = new Notification("");
+var promise = Notification.get();
+promise.then(
+ function onSuccess() {
+ ok(true, "No error when creating a notification without title");
+ },
+ function onFailure() {
+ ok(false, "Should not throw error when creating a notification without title");
+ }
+).then(() => {
+ notification.close();
+}).then(() => {
+ SimpleTest.finish();
+});
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/notification/test_notification_basics.html b/dom/tests/mochitest/notification/test_notification_basics.html
new file mode 100644
index 000000000..3d0465c3f
--- /dev/null
+++ b/dom/tests/mochitest/notification/test_notification_basics.html
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Notification Basics</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="MockServices.js"></script>
+ <script type="text/javascript" src="NotificationTest.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">
+
+ var info = NotificationTest.info;
+ var options;
+
+ SimpleTest.requestFlakyTimeout("untriaged");
+
+ var steps = [
+ function () {
+ info("Test notification spec");
+ ok(Notification, "Notification constructor exists");
+ ok(Notification.permission, "Notification.permission exists");
+ ok(Notification.requestPermission, "Notification.requestPermission exists");
+ ok(Notification.get, "Notification.get exists");
+ },
+
+ function () {
+ info("Test requestPermission without callback");
+ Notification.requestPermission();
+ },
+
+ function (done) {
+ info("Test requestPermission deny");
+ function assertPermissionDenied(perm) {
+ is(perm, "denied", "Permission should be denied.");
+ is(Notification.permission, "denied", "Permission should be denied.");
+ }
+ NotificationTest.denyNotifications();
+ Notification.requestPermission()
+ .then(assertPermissionDenied)
+ .then(_ => Notification.requestPermission(assertPermissionDenied))
+ .catch(err => {
+ ok(!err, "requestPermission should not reject promise");
+ })
+ .then(done);
+ },
+
+ function (done) {
+ info("Test requestPermission grant");
+ function assertPermissionGranted(perm) {
+ is(perm, "granted", "Permission should be granted.");
+ is(Notification.permission, "granted", "Permission should be granted");
+ }
+ NotificationTest.allowNotifications();
+ Notification.requestPermission()
+ .then(assertPermissionGranted)
+ .then(_ => Notification.requestPermission(assertPermissionGranted))
+ .catch(err => {
+ ok(!err, "requestPermission should not reject promise");
+ })
+ .then(done);
+ },
+
+ function (done) {
+ info("Test invalid requestPermission");
+ Notification.requestPermission({})
+ .then(_ => {
+ ok(false, "Non callable arg to requestPermission should reject promise");
+ }, err => {
+ ok(true, "Non callable arg to requestPermission should reject promise");
+ })
+ .then(done);
+ },
+
+ function (done) {
+ info("Test create notification");
+
+ options = NotificationTest.payload;
+
+ var notification = new Notification("This is a title", options);
+
+ ok(notification, "Notification exists");
+ is(notification.onclick, null, "onclick() should be null");
+ is(notification.onshow, null, "onshow() should be null");
+ is(notification.onerror, null, "onerror() should be null");
+ is(notification.onclose, null, "onclose() should be null");
+ is(typeof notification.close, "function", "close() should exist");
+ is(typeof notification.data, "object", "data should be a JS object");
+
+ is(notification.dir, options.dir, "auto should get set");
+ is(notification.lang, options.lang, "lang should get set");
+ is(notification.body, options.body, "body should get set");
+ is(notification.tag, options.tag, "tag should get set");
+ is(notification.icon, options.icon, "icon should get set");
+ ok(NotificationTest.customDataMatches(notification.data),
+ "data should get set");
+
+ // store notification in test context
+ this.notification = notification;
+
+ notification.onshow = function () {
+ ok(true, "onshow handler should be called");
+ done();
+ };
+ },
+
+ function (done) {
+ info("Test closing a notification");
+ var notification = this.notification;
+
+ notification.onclose = function () {
+ ok(true, "onclose handler should be called");
+ done();
+ };
+
+ notification.close();
+ }
+ ];
+
+ MockServices.register();
+ NotificationTest.run(steps, function () {
+ MockServices.unregister();
+ });
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/notification/test_notification_storage.html b/dom/tests/mochitest/notification/test_notification_storage.html
new file mode 100644
index 000000000..ce5530cb8
--- /dev/null
+++ b/dom/tests/mochitest/notification/test_notification_storage.html
@@ -0,0 +1,158 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Notification Basics</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="MockServices.js"></script>
+ <script type="text/javascript" src="NotificationTest.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">
+
+ SimpleTest.requestFlakyTimeout("untriaged");
+
+ function deleteAllNotifications(done) {
+ var promise = Notification.get();
+ promise.then(function (notifications) {
+ notifications.forEach(function(notification) {
+ notification.close();
+ });
+ done();
+ });
+ }
+
+ var info = NotificationTest.info;
+
+ var steps = [
+ function (done) {
+ info("Test that Notifcation.get fulfills the promise");
+ var promise = Notification.get();
+ ok(promise.then, "should return a promise");
+
+ // Create a new notification to make sure
+ // Notification.get() works while creating
+ var notification = new Notification("this is a test");
+
+ promise.then(function () {
+ ok(true, "promise should be fulfilled");
+ done();
+ });
+ },
+
+ deleteAllNotifications,
+
+ function (done) {
+ info("Test adding a notification, and making sure get returns it");
+ NotificationTest.allowNotifications();
+ var options = NotificationTest.payload;
+
+ var notification = new Notification("This is a title", options);
+ var promise = Notification.get();
+ promise.then(function (notifications) {
+ ok(notifications.length, "should return notifications");
+ for (var i = 0; i < notifications.length; i++) {
+ var notification = notifications[i];
+ if (notification.tag === options.tag) {
+ ok(true, "should contain newly created notification");
+ for (var key in options) {
+ if (key === "data") {
+ ok(NotificationTest.customDataMatches(notification.data),
+ "data property should match");
+ continue;
+ }
+ is(notification[key], options[key], key + " property should match");
+ }
+ notification.close();
+ return;
+ }
+ }
+ ok(false, "should contain newly created notification");
+ notification.close();
+ });
+ notification.onclose = done;
+ },
+
+ function (done) {
+ info("Testing fetching notification by tag filter");
+ var n1 = new Notification("title1", {tag: "tag1"});
+ var n2 = new Notification("title2", {tag: "tag2"});
+ var n3 = new Notification("title3", {tag: "tag3"});
+ var promise = Notification.get({tag: "tag3"});
+ promise.then(function (notifications) {
+ var notification = notifications[0];
+ is(notifications.length, 1, "should return 1 notification");
+ is(notifications[0].title, "title3", "titles should match");
+ is(notifications[0].tag, "tag3", "tags should match");
+ var closeCount = 0;
+ var waitForAll = function () {
+ if (++closeCount >= 3) {
+ done();
+ }
+ };
+ n1.onclose = waitForAll;
+ n2.onclose = waitForAll;
+ n3.onclose = waitForAll;
+ n1.close();
+ n2.close();
+ n3.close();
+ });
+ },
+
+ deleteAllNotifications,
+
+ function (done) {
+ info("Testing fetching no notifications");
+ var promise = Notification.get();
+ promise.then(function (notifications) {
+ is(notifications.length, 0, "should return 0 notifications");
+ done();
+ });
+ },
+
+ function (done) {
+ info("Testing fetching multiple notifications");
+ var n1 = new Notification("title1");
+ var n2 = new Notification("title2");
+ var n3 = new Notification("title3");
+ var promise = Notification.get();
+ promise.then(function (notifications) {
+ is(notifications.length, 3, "should return 3 notifications");
+ n1.close();
+ n2.close();
+ n3.close();
+ done();
+ });
+ },
+
+ deleteAllNotifications,
+
+ function (done) {
+ info("Testing 'alertfinished' removes the notification from DB");
+ var n = new Notification("test-title" + Math.random());
+ n.onclose = function() {
+ Notification.get().then(function(notifications) {
+ is(notifications.length, 0, "should return 0 notifications");
+ done();
+ });
+ };
+ info("Installing 'onshow' for " + n.title);
+ n.onshow = function() {
+ info("Triggered 'onshow' for " + n.title);
+ window.setTimeout(function() {
+ NotificationTest.fireCloseEvent(n.title);
+ }, 100);
+ };
+ }
+ ];
+
+ MockServices.register();
+ NotificationTest.run(steps, function () {
+ MockServices.unregister();
+ });
+</script>
+</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 000000000..1acd90bcb
--- /dev/null
+++ b/dom/tests/mochitest/orientation/bug507902-frame.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Frame for watchPosition </title>
+ <script type="text/javascript" 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(){}, false);
+ window.addEventListener("devicemotion", function(){}, false);
+ 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); }, false);
+
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/orientation/mochitest.ini b/dom/tests/mochitest/orientation/mochitest.ini
new file mode 100644
index 000000000..16ffd62de
--- /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 000000000..c608df8cf
--- /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 type="text/javascript" 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(){}, false);
+ window.addEventListener("devicemotion", function(){}, false);
+ 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 000000000..e63b6a274
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" 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 000000000..62c5b2795
--- /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 000000000..995e946e3
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" 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);
+ }
+ }, false);
+
+ 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 000000000..f7ce80759
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_doubleLock.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - file_doubleLockCallBack.html</title>
+ <script type="text/javascript"
+ src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript"
+ 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();
+ }
+ }
+ }, false);
+
+ 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 000000000..73715cabc
--- /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 type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" 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("VK_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 000000000..37311797e
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_infiniteMovement.html
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+ <head>
+ <title>Bug 633602 - file_movementXY.html</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" 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;
+
+ 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");
+ div.removeEventListener("mousemove", firstMoveListener, false);
+ div.addEventListener("mousemove", secondMoveListener, false);
+
+ synthesizeMouse(div,(divCenterWidth/2) * 3,
+ (divCenterHeight/2) * 3, {
+ type: "mousemove"
+ }, window);
+ }
+
+ var secondMoveListener = function (e) {
+ info("Got second mousemove");
+ totalMovementX = divCenterWidth + ((divCenterWidth / 2) * 3);
+ totalMovementY = divCenterHeight + ((divCenterHeight / 2) * 3);
+
+ div.removeEventListener("mousemove", secondMoveListener, false);
+ 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, false);
+
+ divCenterWidth = Math.round(div.getBoundingClientRect().width / 2);
+ divCenterHeight = Math.round(div.getBoundingClientRect().height / 2);
+
+ synthesizeMouse(div, divCenterWidth, divCenterHeight, {
+ type: "mousemove"
+ }, window);
+ } else {
+ info("Got pointerlockchange for exiting");
+ }
+ }, false);
+
+ 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 000000000..27fdb6a1d
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" 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();
+ }
+ }, false);
+
+ 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 000000000..392c924be
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" 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, false);
+ div.addEventListener("mousemove", moveMouseAgain, false);
+
+ 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, false);
+ 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, false);
+ 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 000000000..f74fd0098
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" 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();
+ }
+ }, false);
+
+ 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 000000000..85d004368
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="application/javascript" 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();
+ }
+ }, false);
+
+ document.addEventListener("pointerlockerror", function (e) {
+ prefDisabled = true;
+ addFullscreenChangeContinuation("exit", function() {
+ SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
+ true );
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }, false);
+
+ 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.html b/dom/tests/mochitest/pointerlock/file_pointerlock-api.html
new file mode 100644
index 000000000..721f11a87
--- /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 type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" 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, false);
+
+ 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, false);
+ 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();
+ }
+ }, false);
+
+ 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_pointerlockerror.html b/dom/tests/mochitest/pointerlock/file_pointerlockerror.html
new file mode 100644
index 000000000..0aeb2cb77
--- /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 type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" 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();
+ }, false);
+
+ 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 000000000..1bd70777a
--- /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 type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+<script type="application/javascript" 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 000000000..810154c58
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html
@@ -0,0 +1,207 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - file_retargetMouseEvents.html</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" 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();
+
+ 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() {
+ 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");
+ 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);
+ SimpleTest.executeSoon(function () {
+ synthesizeMouseAtCenter(parent, {type: "mousemove"}, window);
+ });
+ } else {
+ info("Got pointerlockchange for exiting");
+ }
+ }, false);
+
+ 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 000000000..3e8773d56
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+-->
+<head>
+ <title>Bug 633602 - constantXY.html</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" 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 synthesizeNativeMouseMove until it actually happens.
+ mouseMoveIntervalID = setInterval(() => {
+ synthesizeNativeMouseMove(div, (divRect.width / 4) * 3,
+ (divRect.height / 4) * 3);
+ }, 100);
+ } else {
+ info("Got pointerlockchange for exiting");
+ }
+ });
+
+ function start() {
+ div = document.getElementById("div");
+ info("Requesting fullscreen on parent");
+ addFullscreenChangeContinuation("enter", function() {
+ info("Got fullscreenchange for entering");
+ synthesizeNativeMouseMove(div, 0, 0, () => {
+ div.addEventListener("mousemove", moveUnlocked);
+ divRect = div.getBoundingClientRect();
+ // Bug 1295815
+ // Retrigger synthesizeNativeMouseMove until it actually happens.
+ mouseMoveIntervalID = setInterval(() => {
+ synthesizeNativeMouseMove(div, divRect.width / 2, divRect.height / 2);
+ }, 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 000000000..5df31d99c
--- /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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" 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, false);
+
+ parent.addEventListener("mouseout", parentOutListener, false);
+ parent.addEventListener("mouseleave", parentLeaveListener, false);
+ parent.addEventListener("mouseover", parentOverListener, false);
+ parent.addEventListener("mouseenter", parentEnterListener, false);
+
+ child.addEventListener("mouseout", childOutListener, false);
+ child.addEventListener("mouseleave", childLeaveListener, false);
+ child.addEventListener("mouseover", childOverListener, false);
+ child.addEventListener("mouseenter", childEnterListener, false);
+ }
+
+ function removeEventListeners() {
+ parent.removeEventListener("mousemove", parentMoveListener, false);
+
+ parent.removeEventListener("mouseout", parentOutListener, false);
+ parent.removeEventListener("mouseleave", parentLeaveListener, false);
+ parent.removeEventListener("mouseover", parentOverListener, false);
+ parent.removeEventListener("mouseenter", parentEnterListener, false);
+
+ child.removeEventListener("mouseout", childOutListener, false);
+ child.removeEventListener("mouseleave", childLeaveListener, false);
+ child.removeEventListener("mouseover" , childOverListener, false);
+ child.removeEventListener("mouseenter", childEnterListener, false);
+ }
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === parent) {
+ addEventListeners();
+ synthesizeMouseAtCenter(child, { type: "mousemove" }, window);
+ }
+ else {
+ addFullscreenChangeContinuation("exit", function() {
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ }, false);
+
+ 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 000000000..7b19fd30d
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+ <!--
+ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
+ -->
+ <head>
+ <title>Bug 633602 - file_targetOutOfFocus.html</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" 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"></div>
+ <input id="input" type="text" />
+ <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();
+ }, false);
+
+ document.addEventListener("pointerlockchange", function (e) {
+ if (document.pointerLockElement === div) {
+ divPointerLock = true;
+ addFullscreenChangeContinuation("exit", function() {
+ runTests();
+ SimpleTest.finish();
+ });
+ document.exitFullscreen();
+ }
+ }, false);
+
+ 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 000000000..8c30d014f
--- /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 type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
+ </script>
+ <script type="application/javascript" 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();
+ }, false);
+
+ 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 000000000..3b500552a
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/iframe_differentDOM.html
@@ -0,0 +1,7 @@
+<html>
+ <head>
+ </head>
+ <body>
+ <div id="div"></div>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/pointerlock/mochitest.ini b/dom/tests/mochitest/pointerlock/mochitest.ini
new file mode 100644
index 000000000..1d9e92cbc
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/mochitest.ini
@@ -0,0 +1,28 @@
+[DEFAULT]
+skip-if = toolkit == 'android'
+
+[test_closewindow-with-pointerlock.html]
+
+[test_pointerlock-api.html]
+tags = fullscreen
+support-files =
+ pointerlock_utils.js
+ file_pointerlock-api.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
+ iframe_differentDOM.html
diff --git a/dom/tests/mochitest/pointerlock/pointerlock_utils.js b/dom/tests/mochitest/pointerlock/pointerlock_utils.js
new file mode 100644
index 000000000..163315822
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/pointerlock_utils.js
@@ -0,0 +1,120 @@
+// 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();
+};
+
+addLoadEvent(function() {
+ if (typeof start !== 'undefined') {
+ SimpleTest.waitForFocus(start);
+ }
+});
+
+// Returns true if the window occupies the entire screen.
+// Note this only returns true once the transition from normal to
+// fullscreen mode is complete.
+function inFullscreenMode(win) {
+ return win.innerWidth == win.screen.width &&
+ win.innerHeight == win.screen.height;
+}
+
+// Returns true if the window is in normal mode, i.e. non fullscreen mode.
+// Note this only returns true once the transition from fullscreen back to
+// normal mode is complete.
+function inNormalMode(win) {
+ return win.innerWidth == win.normalSize.w &&
+ win.innerHeight == win.normalSize.h;
+}
+
+// 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 dimensions match
+// the window dimensions when the window opened (so don't resize the
+// window while running your test!). 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;
+ // Remember the window size in non-fullscreen mode.
+ if (!topWin.normalSize) {
+ topWin.normalSize = {
+ w: window.innerWidth,
+ h: window.innerHeight
+ };
+ }
+ function checkCondition() {
+ if (type == "enter") {
+ return inFullscreenMode(topWin);
+ } else if (type == "exit") {
+ // If we just revert the state to a previous fullscreen state,
+ // the window won't back to the normal mode. Hence we check
+ // fullscreenElement first here. Note that we need to check
+ // the fullscreen element of the outmost document here instead
+ // of the current one.
+ return topWin.document.fullscreenElement || inNormalMode(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, false);
+ if (checkCondition()) {
+ invokeCallback(event);
+ return;
+ }
+ function onResize() {
+ if (checkCondition()) {
+ topWin.removeEventListener("resize", onResize, false);
+ invokeCallback(event);
+ }
+ }
+ topWin.addEventListener("resize", onResize, false);
+ }
+ doc.addEventListener("fullscreenchange", onFullscreenChange, false);
+}
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 000000000..797228c3e
--- /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 000000000..3094c565e
--- /dev/null
+++ b/dom/tests/mochitest/pointerlock/test_pointerlock-api.html
@@ -0,0 +1,101 @@
+<!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">
+
+ /**
+ * 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.unprefix.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_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 = [
+ ];
+
+ var gTestWindow = null;
+ var gTestIndex = 0;
+
+ function nextTest() {
+ if (gTestWindow) {
+ gTestWindow.close();
+ }
+ SimpleTest.waitForFocus(runNextTest);
+ }
+
+ function runNextTest() {
+ if (gTestIndex < gTestFiles.length) {
+ var file = gTestFiles[gTestIndex];
+ gTestIndex++;
+
+ var skipTest = false;
+ for (var item of gDisableList) {
+ if (item.file == file && navigator.platform == item.platform) {
+ skipTest = true;
+ break;
+ }
+ }
+ if (!skipTest) {
+ info(`Testing ${file}`);
+ gTestWindow = window.open(file, "", "width=500,height=500");
+ } else {
+ nextTest();
+ }
+ } else {
+ SimpleTest.finish();
+ }
+ }
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/chrome.ini b/dom/tests/mochitest/sessionstorage/chrome.ini
new file mode 100644
index 000000000..65112f0f8
--- /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 000000000..e8614dd54
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/file_http.html
@@ -0,0 +1,40 @@
+<html>
+<head>
+<script>
+
+window.addEventListener("message", onMessageReceived, false);
+
+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 000000000..915c54950
--- /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 000000000..787f3ee3e
--- /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 000000000..221ca97e5
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/frameNotEqual.html
@@ -0,0 +1,43 @@
+<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.length, 0, "Num of items is 0");
+
+ sessionStorage.setItem("C", "3");
+ is(sessionStorage.getItem("C"), "3", "C is 3 in the slave");
+ is(sessionStorage.length, 1, "Num of items is 1");
+ break;
+
+ case 4:
+ is(sessionStorage.getItem("C"), "3", "C is 3 in the slave");
+ is(sessionStorage.length, 1, "Num of items is 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 000000000..bf5579c71
--- /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 000000000..e3b3cdbb3
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/interOriginSlave.js
@@ -0,0 +1,42 @@
+function postMsg(message)
+{
+ opener.postMessage(message, "http://mochi.test:8888");
+}
+
+window.addEventListener("message", onMessageReceived, false);
+
+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 000000000..adea77edb
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/interOriginTest.js
@@ -0,0 +1,44 @@
+var slaveLoadsPending = 1;
+
+var slaveOrigin = "";
+var slave = null;
+
+var failureRegExp = new RegExp("^FAILURE");
+const slavePath = "/tests/dom/tests/mochitest/sessionstorage/";
+
+window.addEventListener("message", onMessageReceived, false);
+
+function onMessageReceived(event)
+{
+ //alert("master got event: "+event.data);
+ switch (event.data)
+ {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--slaveLoadsPending)
+ break;
+
+ // Just fall through...
+
+ // Indication of successfully finished step of a test
+ 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 000000000..126216c4f
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/mochitest.ini
@@ -0,0 +1,18 @@
+[DEFAULT]
+support-files =
+ file_http.html
+ file_https.html
+ frameEqual.html
+ frameNotEqual.html
+ frameReplace.html
+ interOriginSlave.js
+ interOriginTest.js
+
+[test_cookieSession.html]
+[test_sessionStorageBase.html]
+[test_sessionStorageBaseSessionOnly.html]
+[test_sessionStorageClone.html]
+skip-if = toolkit == 'android'
+[test_sessionStorageHttpHttps.html]
+skip-if = toolkit == 'android' #TIMED_OUT
+[test_sessionStorageReplace.html]
diff --git a/dom/tests/mochitest/sessionstorage/test_cookieSession.html b/dom/tests/mochitest/sessionstorage/test_cookieSession.html
new file mode 100644
index 000000000..01bd596ee
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_cookieSession.html
@@ -0,0 +1,124 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>cookie per-session only test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+/*
+ Set cookie access to be just per session and store to the sessionStorage.
+ Content stored must prevail only for session of the browser, so it must
+ be accessible in another window we try to access that key in the same
+ storage.
+ */
+
+function pushCookie(aValue, aNext) {
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': aValue, 'context': document}], pushPermissionAndTest);
+}
+
+function pushPermissionAndTest() {
+ var test = tests.shift();
+ if (test) {
+ document.getElementById('testframe').onload = test;
+ /* 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 */
+ document.getElementById('testframe').contentWindow.location.reload();
+ } else {
+ ok(false, 'should not be reached');
+ SimpleTest.finish();
+ }
+}
+
+function startTest() {
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
+}
+
+var tests = [
+ function test1() {
+ sessionStorage.setItem("persistent1", "persistent value 1");
+ sessionStorage.setItem("persistent2", "persistent value 2");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
+ },
+
+ function test2() {
+ sessionStorage.setItem("session only", "session value");
+ is(sessionStorage.getItem("session only"), "session value", "Value present when cookies in session-only mode");
+ is(sessionStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
+ is(sessionStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
+
+ sessionStorage.setItem("persistent1", "changed persistent value 1");
+ sessionStorage.removeItem("persistent2");
+
+ is(sessionStorage.getItem("session only"), "session value", "Value present when cookies in session-only mode");
+ is(sessionStorage.getItem("persistent1"), "changed persistent value 1", "Persistent value present");
+ is(sessionStorage.getItem("persistent2"), null, "Persistent value removed");
+
+ // This clear has to delete only changes made in session only mode
+ sessionStorage.clear();
+
+ is(sessionStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
+ is(sessionStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
+ is(sessionStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
+
+ sessionStorage.setItem("session only 2", "must be deleted on drop of session-only cookies permissions");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
+ },
+
+ function test3() {
+ is(sessionStorage.getItem("session only"), null, "No value when cookies are in default mode");
+ is(sessionStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
+ is(sessionStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
+ is(sessionStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
+ },
+
+ function test4() {
+ is(sessionStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
+ is(sessionStorage.getItem("session only 2"), null, "Value not present when cookies in session-only mode after delete");
+ is(sessionStorage.getItem("persistent1"), "persistent value 1", "Persistent value present again");
+ is(sessionStorage.getItem("persistent2"), "persistent value 2", "Persistent value present again");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
+ },
+
+ function test5() {
+ sessionStorage.clear();
+
+ is(sessionStorage.getItem("session only"), null, "No value when cookies are in default mode");
+ is(sessionStorage.getItem("persistent1"), null, "Persistent value not present after delete");
+ is(sessionStorage.getItem("persistent2"), null, "Persistent value not present after delete");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
+ },
+
+ function test6() {
+ is(sessionStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
+ is(sessionStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
+ is(sessionStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
+ is(sessionStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
+
+ pushCookie(SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
+ },
+
+ function test7() {
+ SimpleTest.finish();
+ }
+];
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body onload="startTest();">
+<iframe id="testframe" src="data:text/html;charset=utf-8,"></iframe>
+</body>
+</html>
diff --git a/dom/tests/mochitest/sessionstorage/test_sessionStorageBase.html b/dom/tests/mochitest/sessionstorage/test_sessionStorageBase.html
new file mode 100644
index 000000000..c1d9f712b
--- /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 type="text/javascript" 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 > 0, "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 000000000..38db680ce
--- /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 type="text/javascript" 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" src="data:text/html;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 000000000..68370867e
--- /dev/null
+++ b/dom/tests/mochitest/sessionstorage/test_sessionStorageClone.html
@@ -0,0 +1,94 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage clone equal origins</title>
+
+<script type="text/javascript" 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)
+{
+}
+*/
+
+function doNextTest()
+{
+ // 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 = "http://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_sessionStorageFromChrome.xhtml b/dom/tests/mochitest/sessionstorage/test_sessionStorageFromChrome.xhtml
new file mode 100644
index 000000000..79a5a9280
--- /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 type="text/javascript" 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 000000000..e145ee16b
--- /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 type="text/javascript" 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, false);
+
+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 000000000..007188a2e
--- /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 type="text/javascript" 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, false);
+
+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/storageevent/frameLocalStorageMaster.html b/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html
new file mode 100644
index 000000000..b4f372d6c
--- /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;
+}, false);
+
+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');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html
new file mode 100644
index 000000000..3bde58c49
--- /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);
+}, false);
+
+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');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html
new file mode 100644
index 000000000..ba0e4ff98
--- /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;
+}, false);
+
+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');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html b/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html
new file mode 100644
index 000000000..70e89f7e4
--- /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;
+}, false);
+
+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');">
+ <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 000000000..a101b8858
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html
@@ -0,0 +1,66 @@
+<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;
+}, false);
+
+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;
+}
+
+</script>
+
+</head>
+
+<body onload="postMsg('frame loaded');">
+ <iframe src="http://example.com:80/tests/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html"
+ 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 000000000..287cb22f6
--- /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);
+}, false);
+
+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');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html
new file mode 100644
index 000000000..ba0e4ff98
--- /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;
+}, false);
+
+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');">
+</body>
+</html>
diff --git a/dom/tests/mochitest/storageevent/interOriginFrame.js b/dom/tests/mochitest/storageevent/interOriginFrame.js
new file mode 100644
index 000000000..b1180c908
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/interOriginFrame.js
@@ -0,0 +1,56 @@
+function postMsg(message)
+{
+ var l = SpecialPowers.wrap(parent.window.location);
+ parent.postMessage(message, l.protocol + "//" + l.host);
+}
+
+window.addEventListener("message", onMessageReceived, false);
+
+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 000000000..939462a4c
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/interOriginTest2.js
@@ -0,0 +1,59 @@
+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, false);
+
+function onMessageReceived(event)
+{
+
+ switch (event.data)
+ {
+ // Indication of the frame onload event
+ case "frame loaded":
+ if (--frameLoadsPending)
+ break;
+
+ // Just fall through...
+
+ // Indication of successfully finished step of a test
+ case "perf":
+ if (callMasterFrame)
+ masterFrame.postMessage("step", "*");
+ else if (slaveFrame)
+ slaveFrame.postMessage("step", "*");
+ else if (SpecialPowers.wrap(masterFrame).slaveFrame)
+ SpecialPowers.wrap(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 000000000..e16d9cd2e
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/mochitest.ini
@@ -0,0 +1,17 @@
+[DEFAULT]
+support-files =
+ frameLocalStorageMaster.html
+ frameLocalStorageSlaveEqual.html
+ frameLocalStorageSlaveNotEqual.html
+ frameSessionStorageMasterEqual.html
+ frameSessionStorageMasterNotEqual.html
+ frameSessionStorageSlaveEqual.html
+ frameSessionStorageSlaveNotEqual.html
+ interOriginFrame.js
+ interOriginTest2.js
+
+[test_storageLocalStorageEventCheckNoPropagation.html]
+[test_storageLocalStorageEventCheckPropagation.html]
+[test_storageNotifications.html]
+[test_storageSessionStorageEventCheckNoPropagation.html]
+[test_storageSessionStorageEventCheckPropagation.html]
diff --git a/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckNoPropagation.html b/dom/tests/mochitest/storageevent/test_storageLocalStorageEventCheckNoPropagation.html
new file mode 100644
index 000000000..0abfff454
--- /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 type="text/javascript" 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 000000000..3ac4ac879
--- /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 type="text/javascript" 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 000000000..8d11a5a77
--- /dev/null
+++ b/dom/tests/mochitest/storageevent/test_storageNotifications.html
@@ -0,0 +1,127 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>sessionStorage basic test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="application/javascript;version=1.7">
+
+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]");
+
+ var onStorageChanged = {
+ observe: function(subject, topic, type) {
+ if (topic == "dom-storage2-changed") {
+ ok(expectedTypes.length > 0, "Not more then expected events encountered");
+ is(type, expectedTypes.shift(), "Expected type of the storage notificaiton");
+ tests.next();
+ }
+ }
+ }
+
+ // Listen for dom-storage2-changed notification
+ SpecialPowers.Services.obs.addObserver(onStorageChanged,
+ "dom-storage2-changed", false);
+
+ // 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.Services.obs.removeObserver(onStorageChanged,
+ "dom-storage2-changed", false);
+ 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 000000000..0b7f3ea67
--- /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 type="text/javascript" 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 000000000..86c8ea348
--- /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 type="text/javascript" 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/inert_style.css b/dom/tests/mochitest/webcomponents/inert_style.css
new file mode 100644
index 000000000..3b005ede8
--- /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 000000000..496f7ea4d
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/mochitest.ini
@@ -0,0 +1,48 @@
+[DEFAULT]
+support-files =
+ inert_style.css
+
+[test_bug900724.html]
+[test_bug1017896.html]
+[test_bug1176757.html]
+[test_bug1276240.html]
+[test_content_element.html]
+[test_custom_element_adopt_callbacks.html]
+[test_custom_element_callback_innerhtml.html]
+[test_custom_element_clone_callbacks.html]
+[test_custom_element_clone_callbacks_extended.html]
+[test_custom_element_import_node_created_callback.html]
+[test_custom_element_in_shadow.html]
+[test_custom_element_register_invalid_callbacks.html]
+[test_custom_element_get.html]
+[test_custom_element_when_defined.html]
+[test_nested_content_element.html]
+[test_dest_insertion_points.html]
+[test_dest_insertion_points_shadow.html]
+[test_fallback_dest_insertion_points.html]
+[test_detached_style.html]
+[test_dynamic_content_element_matching.html]
+[test_document_adoptnode.html]
+[test_document_importnode.html]
+[test_document_register.html]
+[test_document_register_base_queue.html]
+[test_document_register_lifecycle.html]
+[test_document_register_parser.html]
+[test_document_register_stack.html]
+[test_document_shared_registry.html]
+[test_event_dispatch.html]
+[test_event_retarget.html]
+[test_event_stopping.html]
+[test_template.html]
+[test_template_xhtml.html]
+[test_template_custom_elements.html]
+[test_shadowroot.html]
+[test_shadowroot_inert_element.html]
+[test_shadowroot_host.html]
+[test_shadowroot_style.html]
+[test_shadowroot_style_multiple_shadow.html]
+[test_shadowroot_style_order.html]
+[test_shadowroot_youngershadowroot.html]
+[test_style_fallback_content.html]
+[test_unresolved_pseudo_class.html]
+[test_link_prefetch.html]
diff --git a/dom/tests/mochitest/webcomponents/test_bug1017896.html b/dom/tests/mochitest/webcomponents/test_bug1017896.html
new file mode 100644
index 000000000..befec7d6d
--- /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 type="text/javascript" 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_bug1176757.html b/dom/tests/mochitest/webcomponents/test_bug1176757.html
new file mode 100644
index 000000000..57a7a73b7
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_bug1176757.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1176757
+-->
+<head>
+ <title>Test for Bug 1176757</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" 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=1176757">Mozilla Bug 1176757</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 1176757 **/
+var element = document.createElement("a");
+var shadowRoot = element.createShadowRoot();
+var thrownException = false;
+
+try {
+ shadowRoot.cloneNode();
+} catch(err) {
+ thrownException = err;
+}
+
+ok(thrownException !== false, "An exception should've been thrown");
+is(thrownException.name, "DataCloneError", "A DataCloneError exception should've been thrown");
+
+</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 000000000..33e532a6a
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_bug1276240.html
@@ -0,0 +1,55 @@
+<!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 type="text/javascript" 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);
+}
+
+function runTest() {
+ test();
+ SimpleTest.finish();
+}
+
+// test with webcomponents enabled
+test();
+
+// test with webcomponents disabled
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv(
+ { 'set': [["dom.webcomponents.enabled", false]]}, runTest);
+
+</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 000000000..3d9b9184f
--- /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 type="text/javascript" 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_content_element.html b/dom/tests/mochitest/webcomponents/test_content_element.html
new file mode 100644
index 000000000..39f0cf07d
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_content_element.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for HTMLContent element</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="grabme"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+// Create a ShadowRoot and append some nodes, containing an insertion point with a universal selector.
+var shadow = $("grabme").createShadowRoot();
+shadow.innerHTML = '<span><content id="point"></content></span>';
+
+// Get the insertion point from the ShadowRoot and check that child of host is distributed.
+// Insertion point should match everything because the selector set is empty.
+var insertionPoint = shadow.getElementById("point");
+$("grabme").innerHTML = '<div id="distme"></div>';
+var distNodes = insertionPoint.getDistributedNodes();
+is(distNodes[0], $("distme"), "Child of bound content should be distributed into insertion point with universal selector.");
+is(distNodes.length, 1, "Should only have one child distributed into insertion point.");
+
+// Add another node to bound content and make sure that the node list is static and does not change.
+var someSpan = document.createElement("span");
+$("grabme").appendChild(someSpan);
+is(distNodes.length, 1, "NodeList from getDistributedNodes should be static.");
+
+// Test content select.
+$("grabme").innerHTML = '<div id="first" class="tall"></div><div id="second" class="skinny"></div>';
+shadow.innerHTML = '<span><content select=".tall" id="point"></content></span>';
+var insertionPoint = shadow.getElementById("point");
+distNodes = insertionPoint.getDistributedNodes();
+is(distNodes.length, 1, "Insertion point should only match element with the 'tall' class.");
+is(distNodes[0], $("first"), "Insertion point should only match element with the 'tall' class.");
+
+// Get rid of the select attribute and check that the insertion point matches everything.
+insertionPoint.removeAttribute("select");
+is(insertionPoint.getDistributedNodes().length, 2, "After removing the 'select' attribute, the insertion point should match everything.");
+
+// Set an invalid selector and make sure that nothing is matched.
+insertionPoint.setAttribute("select", "div:first-child");
+is(insertionPoint.getDistributedNodes().length, 0, "Invalid selectors should match nothing.");
+
+// all compound selectors must only be permitted simple selectors.
+insertionPoint.setAttribute("select", "div:first-child, span");
+is(insertionPoint.getDistributedNodes().length, 0, "Invalid selectors should match nothing.");
+
+// Test multiple compound selectors.
+$("grabme").innerHTML = '<div id="first"></div><span id="second"></span><span data-match-me="pickme" id="third"></span>';
+insertionPoint.setAttribute("select", "span[data-match-me=pickme], div");
+distNodes = insertionPoint.getDistributedNodes();
+is(distNodes.length, 2, "Insertion point selector should only match two nodes.");
+is(distNodes[0], $("first"), "First child node should match selector.");
+is(distNodes[1], $("third"), "Third child node should match selector.");
+
+// Test select property
+insertionPoint.select = "#second, #third";
+distNodes = insertionPoint.getDistributedNodes();
+is(distNodes.length, 2, "Insertion point selector (set using property) should only match two nodes.");
+is(distNodes[0], $("second"), "First child node should match selector.");
+is(distNodes[1], $("third"), "Third child node should match selector.");
+is(insertionPoint.select, "#second, #third", "select property should be transparent.");
+
+// Empty set of selectors should match everything.
+insertionPoint.select = "";
+is(insertionPoint.getDistributedNodes().length, 3, "Empty set of selectors (set using property) should match everything.");
+
+// Remove insertion point and make sure that the point does not have any nodes distributed.
+$("grabme").innerHTML = '<div></div><span></span>';
+insertionPoint.removeAttribute("select");
+is(insertionPoint.getDistributedNodes().length, 2, "Insertion point with univeral selector should match two nodes.");
+var insertionParent = insertionPoint.parentNode;
+insertionParent.removeChild(insertionPoint);
+is(insertionPoint.getDistributedNodes().length, 0, "Insertion point should match no nodes after removal.");
+insertionParent.appendChild(insertionPoint);
+is(insertionPoint.getDistributedNodes().length, 2, "Insertion point should match two nodes after appending.");
+
+// Test multiple insertion points and check tree order distribution of points.
+// Append two divs and three spans into host.
+$("grabme").innerHTML = '<div></div><span></span><div></div><span></span><span></span>';
+shadow.innerHTML = '<content select="div" id="divpoint"></content><content select="div, span" id="allpoint"></content>';
+// Insertion point matching div
+var divPoint = shadow.getElementById("divpoint");
+// Insertion point matching span and div
+var allPoint = shadow.getElementById("allpoint");
+
+is(divPoint.getDistributedNodes().length, 2, "Two div nodes should be distributed into divPoint.");
+is(allPoint.getDistributedNodes().length, 3, "Remaining nodes should be distributed into allPoint.");
+
+shadow.removeChild(allPoint);
+is(divPoint.getDistributedNodes().length, 2, "Number of div distributed into insertion point should not change.");
+is(allPoint.getDistributedNodes().length, 0, "Removed insertion point should not have any nodes.");
+
+shadow.insertBefore(allPoint, divPoint);
+is(allPoint.getDistributedNodes().length, 5, "allPoint should have nodes distributed before divPoint.");
+is(divPoint.getDistributedNodes().length, 0, "divPoint should have no distributed nodes because they are all distributed to allPoint.");
+
+// Make sure that fallback content are in the distributed nodes.
+$("grabme").innerHTML = '<div id="one"></div><div id="two"></div>';
+shadow.innerHTML = '<content select="#nothing" id="point"><span id="fallback"></span></content>';
+insertionPoint = shadow.getElementById("point");
+is(insertionPoint.getDistributedNodes().length, 1, "There should be one distributed node from fallback content.");
+is(insertionPoint.getDistributedNodes()[0].id, "fallback", "Distributed node should be fallback content.");
+
+$("grabme").innerHTML = '';
+shadow.innerHTML = '<content select="div" id="point"><span id="one"></span><span id="two"></span></content>';
+insertionPoint = shadow.getElementById("point");
+// Make sure that two fallback nodes are distributed into the insertion point.
+is(insertionPoint.getDistributedNodes().length, 2, "There should be two distributed nodes from fallback content.");
+is(insertionPoint.getDistributedNodes()[0].id, "one", "First distributed node should have an ID of one.");
+is(insertionPoint.getDistributedNodes()[1].id, "two", "Second distributed node should have an ID of two.");
+
+// Append a node that gets matched by the insertion point, thus causing the fallback content to be removed.
+var matchingDiv = document.createElement("div");
+matchingDiv.id = "three";
+$("grabme").appendChild(matchingDiv);
+is(insertionPoint.getDistributedNodes().length, 1, "There should be one node distributed from the host.");
+is(insertionPoint.getDistributedNodes()[0].id, "three", "Node distriubted from host should have id of three.");
+
+// Remove the matching node from the host and make sure that the fallback content gets distributed.
+$("grabme").removeChild(matchingDiv);
+is(insertionPoint.getDistributedNodes().length, 2, "There should be two distributed nodes from fallback content.");
+is(insertionPoint.getDistributedNodes()[0].id, "one", "First distributed node should have an ID of one.");
+is(insertionPoint.getDistributedNodes()[1].id, "two", "Second distributed node should have an ID of two.");
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_adopt_callbacks.html b/dom/tests/mochitest/webcomponents/test_custom_element_adopt_callbacks.html
new file mode 100644
index 000000000..28597b7c6
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_adopt_callbacks.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1081039
+-->
+<head>
+ <title>Test callbacks for adopted custom elements.</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<template id="template"><x-foo></x-foo></template>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1081039">Bug 1081039</a>
+<script>
+
+var p = Object.create(HTMLElement.prototype);
+p.createdCallback = function() {
+ ok(false, "Created callback should not be called for adopted node.");
+};
+
+document.registerElement("x-foo", { prototype: p });
+
+var template = document.getElementById("template");
+var adoptedFoo = document.adoptNode(template.content.firstChild);
+is(adoptedFoo.nodeName, "X-FOO");
+
+</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 000000000..94b02032f
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_callback_innerhtml.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1102502
+-->
+<head>
+ <title>Test for attached callback for element created in the document by the parser</title>
+ <script type="text/javascript" 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 attachedCallbackCount = 0;
+
+var p = Object.create(HTMLElement.prototype);
+
+p.createdCallback = function() {
+ ok(true, "createdCallback called.");
+};
+
+p.attachedCallback = function() {
+ ok(true, "attachedCallback should be called when the parser creates an element in the document.");
+ attachedCallbackCount++;
+ // attachedCallback should be called twice, once for the element created for innerHTML and
+ // once for the element created in this document.
+ if (attachedCallbackCount == 2) {
+ SimpleTest.finish();
+ }
+}
+
+document.registerElement("x-foo", { prototype: p });
+
+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_clone_callbacks.html b/dom/tests/mochitest/webcomponents/test_custom_element_clone_callbacks.html
new file mode 100644
index 000000000..eea9bafe0
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_clone_callbacks.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1081039
+-->
+<head>
+ <title>Test callbacks for cloned custom elements.</title>
+ <script type="text/javascript" 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=1081039">Bug 1081039</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+// Test to make sure created callback is called on clones that are upgraded and clones
+// created after registering the custom element.
+
+var callbackCalledOnUpgrade = false;
+var callbackCalledOnClone = false;
+
+var foo = document.createElement("x-foo");
+var fooClone = foo.cloneNode(true);
+
+var p = Object.create(HTMLElement.prototype);
+p.createdCallback = function() {
+ is(this.__proto__, p, "Correct prototype should be set on custom elements.");
+
+ if (this == fooClone) {
+ // Callback called for the element created before registering the custom element.
+ // Should be called on element upgrade.
+ is(callbackCalledOnUpgrade, false, "Upgrade should only be called once per clone.");
+ callbackCalledOnUpgrade = true;
+ } else if (this != foo) {
+ // Callback called for the element created after registering the custom element.
+ is(callbackCalledOnClone, false, "Upgrade should only be called once per clone.");
+ callbackCalledOnClone = true;
+ }
+
+ if (callbackCalledOnUpgrade && callbackCalledOnClone) {
+ SimpleTest.finish();
+ }
+};
+
+document.registerElement("x-foo", { prototype: p });
+
+var anotherFooClone = foo.cloneNode(true);
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_clone_callbacks_extended.html b/dom/tests/mochitest/webcomponents/test_custom_element_clone_callbacks_extended.html
new file mode 100644
index 000000000..b3531b0ea
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_clone_callbacks_extended.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1081039
+-->
+<head>
+ <title>Test callbacks for cloned extended custom elements.</title>
+ <script type="text/javascript" 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=1081039">Bug 1081039</a>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+// Test to make sure created callback is called on clones created after
+// registering the custom element.
+
+var count = 0;
+var p = Object.create(HTMLButtonElement.prototype);
+p.createdCallback = function() { // should be called by createElement and cloneNode
+ is(this.__proto__, p, "Correct prototype should be set on custom elements.");
+
+ if (++count == 2) {
+ SimpleTest.finish();
+ }
+};
+
+document.registerElement("x-foo", { prototype: p, extends: "button" });
+var foo = document.createElement("button", {is: "x-foo"});
+is(foo.getAttribute("is"), "x-foo");
+
+var fooClone = foo.cloneNode(true);
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</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 000000000..3920ea343
--- /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 type="text/javascript" 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_import_node_created_callback.html b/dom/tests/mochitest/webcomponents/test_custom_element_import_node_created_callback.html
new file mode 100644
index 000000000..f533b507c
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_import_node_created_callback.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1093680
+-->
+<head>
+ <title>Test created callback order for imported custom element.</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<template id="template"><x-foo><span></span></x-foo></template>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1093680">Bug 1093680</a>
+<script>
+
+var fooProtoCreatedCallbackCalled = false;
+var fooProto = Object.create(HTMLElement.prototype);
+fooProto.createdCallback = function() {
+ ok(this.firstElementChild, "When the created callback is called, the element should already have a child because the callback should only be called after cloning all the contents.");
+ fooProtoCreatedCallbackCalled = true;
+};
+
+document.registerElement("x-foo", { prototype: fooProto });
+
+var template = document.getElementById("template");
+
+// Importing node will implicityly clone the conent in the main document.
+var adoptedFoo = document.importNode(template.content, true);
+
+ok(fooProtoCreatedCallbackCalled, "Created callback should be called after importing custom element into document");
+
+</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 000000000..504140648
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_in_shadow.html
@@ -0,0 +1,132 @@
+<!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="/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>
+<div id="container"></div>
+
+<script>
+
+// Test callback for custom element when used after registration.
+
+var createdCallbackCount = 0;
+var attachedCallbackCount = 0;
+var detachedCallbackCount = 0;
+var attributeChangedCallbackCount = 0;
+
+var p1 = Object.create(HTMLElement.prototype);
+
+p1.createdCallback = function() {
+ createdCallbackCount++;
+};
+
+p1.attachedCallback = function() {
+ attachedCallbackCount++;
+};
+
+p1.detachedCallback = function() {
+ detachedCallbackCount++;
+};
+
+p1.attributeChangedCallback = function(name, oldValue, newValue) {
+ attributeChangedCallbackCount++;
+};
+
+document.registerElement("x-foo", { prototype: p1 });
+
+var container = document.getElementById("container");
+var shadow = container.createShadowRoot();
+
+is(createdCallbackCount, 0, "createdCallback should not be called more than once in this test.");
+var customElem = document.createElement("x-foo");
+is(createdCallbackCount, 1, "createdCallback should be called after creating custom element.");
+
+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(attachedCallbackCount, 0, "attachedCallback should not be called on an element that is not in a document/composed document.");
+shadow.appendChild(customElem);
+is(attachedCallbackCount, 1, "attachedCallback should be called after attaching custom element to the composed document.");
+
+is(detachedCallbackCount, 0, "detachedCallback should not be called without detaching custom element.");
+shadow.removeChild(customElem);
+is(detachedCallbackCount, 1, "detachedCallback should be called after detaching custom element from the composed document.");
+
+// Test callback for custom element already in the composed doc when created.
+
+createdCallbackCount = 0;
+attachedCallbackCount = 0;
+detachedCallbackCount = 0;
+attributeChangedCallbackCount = 0;
+
+shadow.innerHTML = "<x-foo></x-foo>";
+is(createdCallbackCount, 1, "createdCallback should be called after creating a custom element.");
+is(attachedCallbackCount, 1, "attachedCallback should be called after creating an element in the composed document.");
+
+shadow.innerHTML = "";
+is(detachedCallbackCount, 1, "detachedCallback 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.
+
+createdCallbackCount = 0;
+attachedCallbackCount = 0;
+detachedCallbackCount = 0;
+attributeChangedCallbackCount = 0;
+
+var host = document.createElement("div");
+shadow = host.createShadowRoot();
+customElem = document.createElement("x-foo");
+
+is(attachedCallbackCount, 0, "attachedCallback should not be called on newly created element.");
+shadow.appendChild(customElem);
+is(attachedCallbackCount, 0, "attachedCallback should not be called on attaching to a tree that is not in the composed document.");
+
+is(attachedCallbackCount, 0, "detachedCallback should not be called.");
+shadow.removeChild(customElem);
+is(detachedCallbackCount, 0, "detachedCallback should not be called when detaching from a tree that is not in the composed document.");
+
+shadow.appendChild(customElem);
+is(attachedCallbackCount, 0, "attachedCallback should still not be called after reattaching to a shadow tree that is not in the composed document.");
+
+container.appendChild(host);
+is(attachedCallbackCount, 1, "attachedCallback should be called after host is inserted into document.");
+
+container.removeChild(host);
+is(detachedCallbackCount, 1, "detachedCallback should be called after host is removed from document.");
+
+// Test callback for custom element for upgraded element.
+
+createdCallbackCount = 0;
+attachedCallbackCount = 0;
+detachedCallbackCount = 0;
+attributeChangedCallbackCount = 0;
+
+shadow = container.shadowRoot;
+shadow.innerHTML = "<x-bar></x-bar>";
+
+var p2 = Object.create(HTMLElement.prototype);
+
+p2.createdCallback = function() {
+ createdCallbackCount++;
+};
+
+p2.attachedCallback = function() {
+ attachedCallbackCount++;
+};
+
+document.registerElement("x-bar", { prototype: p2 });
+is(createdCallbackCount, 1, "createdCallback should be called after registering element.");
+is(attachedCallbackCount, 1, "attachedCallback should be called after upgrading element in composed document.");
+
+</script>
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_register_invalid_callbacks.html b/dom/tests/mochitest/webcomponents/test_custom_element_register_invalid_callbacks.html
new file mode 100644
index 000000000..a349f4aa5
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_register_invalid_callbacks.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1275835
+-->
+<head>
+ <title>Test registering invalid lifecycle callbacks for custom elements.</title>
+ <script type="text/javascript" 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=1275835">Bug 1275835</a>
+<iframe id="iframe"></iframe>
+<script>
+
+// Use window from iframe to isolate the test.
+const testWindow = iframe.contentDocument.defaultView;
+
+// This is for backward compatibility.
+// We should do the same checks for the callbacks from v0 spec.
+[
+ 'createdCallback',
+ 'attachedCallback',
+ 'detachedCallback',
+ 'attributeChangedCallback',
+].forEach(callback => {
+ var c = class {};
+ var p = c.prototype;
+
+ // Test getting callback throws exception.
+ Object.defineProperty(p, callback, {
+ get() {
+ const e = new Error('this is rethrown');
+ e.name = 'rethrown';
+ throw e;
+ }
+ });
+
+ SimpleTest.doesThrow(() => {
+ testWindow.document.registerElement(`test-register-${callback}-rethrown`,
+ { prototype: p });
+ }, `document.registerElement should throw exception if prototype.${callback} throws`);
+
+ SimpleTest.doesThrow(() => {
+ testWindow.customElements.define(`test-define-${callback}-rethrown`, c);
+ }, `customElements.define should throw exception if constructor.${callback} throws`);
+
+ // Test callback is not callable.
+ [
+ { name: 'null', value: null },
+ { name: 'object', value: {} },
+ { name: 'integer', value: 1 },
+ ].forEach(data => {
+ var c = class {};
+ var p = c.prototype;
+
+ p[callback] = data.value;
+
+ SimpleTest.doesThrow(() => {
+ testWindow.document.registerElement(`test-register-${callback}-${data.name}`,
+ { prototype: p });
+ }, `document.registerElement should throw exception if ${callback} is ${data.name}`);
+
+ SimpleTest.doesThrow(() => {
+ testWindow.customElements.define(`test-define-${callback}-${data.name}`, c);
+ }, `customElements.define should throw exception if ${callback} is ${data.name}`);
+ });
+});
+
+</script>
+</body>
+</html>
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 000000000..a71530ae0
--- /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 type="text/javascript" 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_dest_insertion_points.html b/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html
new file mode 100644
index 000000000..2d4a92ed2
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=999999
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 999999</title>
+ <script type="application/javascript" 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=999999">Mozilla Bug 999999</a>
+<p id="display"></p>
+<div id="content">
+<div id="shadowhost">
+</div>
+</div>
+<pre id="test">
+</pre>
+<script type="application/javascript">
+
+/** Test for Bug 999999 **/
+var host = document.getElementById("shadowhost");
+
+// Test destination insertion points of node distributed to content element.
+var shadowRoot = host.createShadowRoot();
+shadowRoot.innerHTML = '<div id="innerhost"><content id="innercontent" select=".red"></content></div>';
+var innerContent = shadowRoot.getElementById("innercontent");
+
+var span = document.createElement("span");
+span.setAttribute("class", "red blue");
+is(host.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty when not being distributed.");
+
+host.appendChild(span);
+
+is(span.getDestinationInsertionPoints().length, 1, "Destination insertion points should only contain a single content insertion point.");
+is(span.getDestinationInsertionPoints()[0], innerContent, "Content element should contain destination insertion point.");
+
+// Test destination insertion points of redistributed node.
+var innerHost = shadowRoot.getElementById("innerhost");
+var innerShadowRoot = innerHost.createShadowRoot();
+innerShadowRoot.innerHTML = '<content id="innerinnercontent" select=".blue"></content>';
+
+var innerInnerContent = innerShadowRoot.getElementById("innerinnercontent");
+
+is(span.getDestinationInsertionPoints().length, 2, "Redistributed node should have 2 destination insertion points.");
+is(span.getDestinationInsertionPoints()[1], innerInnerContent, "Nested content insertion point should be in list of destination insertion points.");
+
+// Test destination insertion points after removing reprojection onto second content element.
+span.setAttribute("class", "red");
+is(span.getDestinationInsertionPoints().length, 1, "Destination insertion points should only contain 1 insertion point after removing reprojection.");
+is(span.getDestinationInsertionPoints()[0], innerContent, "First content element should be only insertion point after removing reprojection.");
+
+// Test destination insertion points after removing the projected content from the host.
+host.removeChild(span);
+is(span.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty after being removed from the shadow host.");
+
+// Test destination insertion points of distributed content after removing insertion point.
+var div = document.createElement("div");
+div.setAttribute("class", "red blue");
+host.appendChild(div);
+
+is(div.getDestinationInsertionPoints().length, 2, "Div should be distributed into 2 insertion points.");
+
+innerShadowRoot.removeChild(innerInnerContent);
+
+is(div.getDestinationInsertionPoints().length, 1, "Div should be distributed into insertion point in one ShadowRoot.");
+is(div.getDestinationInsertionPoints()[0], innerContent, "Destination insertion points should only contain content insertion point in first ShadowRoot.");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html b/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html
new file mode 100644
index 000000000..75286463e
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=999999
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 999999</title>
+ <script type="application/javascript" 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=999999">Mozilla Bug 999999</a>
+<p id="display"></p>
+<div id="content">
+<div id="shadowhost"></div>
+</div>
+<pre id="test">
+</pre>
+<script type="application/javascript">
+
+/** Test for Bug 999999 **/
+var host = document.getElementById("shadowhost");
+
+// Test destination insertion points of node distributed to shadow element.
+var olderShadowRoot = host.createShadowRoot();
+var youngerShadowRoot = host.createShadowRoot();
+
+var shadowElem = document.createElement("shadow");
+youngerShadowRoot.appendChild(shadowElem);
+
+var span = document.createElement("span");
+olderShadowRoot.appendChild(span);
+
+is(span.getDestinationInsertionPoints().length, 1, "Child of ShadowRoot should be distributed to shadow insertion point.");
+is(span.getDestinationInsertionPoints()[0], shadowElem, "Shadow element should be in destination insertion point list.");
+
+// Test destination insertion points of node removed from tree.
+olderShadowRoot.removeChild(span);
+is(span.getDestinationInsertionPoints().length, 0, "Node removed from tree should no longer be distributed.");
+
+// Test destination insertion points of fallback content being reprojected into a shadow element.
+var content = document.createElement("content");
+var fallback = document.createElement("span");
+
+content.appendChild(fallback);
+olderShadowRoot.appendChild(content);
+
+is(fallback.getDestinationInsertionPoints().length, 2, "The fallback content should have 2 destination insertion points, the parent content and the shadow element to which it is reprojected.");
+is(fallback.getDestinationInsertionPoints()[0], content, "First destination of the fallback content should be the parent content element.");
+is(fallback.getDestinationInsertionPoints()[1], shadowElem, "Second destination of the fallback content should be the shadow element to which the element is reprojected.");
+
+// Test destination insertion points of fallback content being removed from tree.
+content.removeChild(fallback);
+is(fallback.getDestinationInsertionPoints().length, 0, "The content should no longer be distributed to any nodes because it is no longer fallback content.");
+
+// Test destination insertion points of distributed content after removing shadow insertion point.
+var div = document.createElement("div");
+olderShadowRoot.appendChild(div);
+is(div.getDestinationInsertionPoints().length, 1, "Children in older shadow root should be distributed to shadow insertion point.");
+is(div.getDestinationInsertionPoints()[0], shadowElem, "Destination insertion point should include shadow element.");
+
+youngerShadowRoot.removeChild(shadowElem);
+is(div.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty after removing shadow element.");
+
+</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 000000000..9c52e2d29
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_detached_style.html
@@ -0,0 +1,25 @@
+<!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="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="grabme"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1062578">Bug 1062578</a>
+<script>
+var host = document.createElement("div");
+var shadow = host.createShadowRoot();
+shadow.innerHTML = '<style> #inner { height: 200px; } </style><div id="inner">Hello</div>';
+
+grabme.appendChild(host);
+
+var inner = shadow.getElementById("inner");
+is(getComputedStyle(inner, null).getPropertyValue("height"), "200px", "Style in shadow root should take effect.");
+</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 000000000..b00bb4fac
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_adoptnode.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1177991
+-->
+<head>
+ <title>Test for Bug 1177991</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" 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">
+
+var thrownException = false;
+var shadowRoot = document.createElement('a').createShadowRoot();
+
+try {
+ document.adoptNode(shadowRoot);
+} catch(err) {
+ thrownException = err;
+}
+
+ok(thrownException !== false, "A HierarchyRequestError");
+is(thrownException.name, "HierarchyRequestError", "A HierarchyRequestError should've been thrown");
+
+</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 000000000..f9042fddf
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_importnode.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1177914
+-->
+<head>
+ <title>Test for Bug 1177914</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" 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">
+
+var thrownException = false;
+var shadowRoot = document.createElement('a').createShadowRoot();
+
+try {
+ document.importNode(shadowRoot);
+} catch(err) {
+ thrownException = err;
+}
+
+
+ok(thrownException !== false, "An exception should've been thrown");
+is(thrownException.name, "NotSupportedError", "A NotSupportedError exception should've been thrown");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_register.html b/dom/tests/mochitest/webcomponents/test_document_register.html
new file mode 100644
index 000000000..a9c194b60
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_register.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for document.registerElement using custom prototype</title>
+ <script type="text/javascript" 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 testRegisterExtend(tag, extend, proto, expectException) {
+ try {
+ document.registerElement(tag, { prototype: proto, extends: extend });
+ ok(!expectException, "Registered " + tag + " extending " + extend + " containing " + proto + " in proto chain.");
+ } catch (ex) {
+ ok(expectException, "Did not register " + tag + " extending " + extend + " containing " + proto + " in proto chain.");
+ }
+}
+
+function testRegisterSimple(tag, proto, expectException) {
+ try {
+ document.registerElement(tag, { prototype: proto });
+ ok(!expectException, "Registered " + tag + " containing " + proto + " in proto chain.");
+ } catch (ex) {
+ ok(expectException, "Did not register " + tag + " containing " + proto + " in proto chain.");
+ }
+}
+
+function startTest() {
+ // Test registering some simple prototypes.
+ testRegisterSimple("x-html-obj-elem", Object.create(HTMLElement.prototype), false);
+ testRegisterSimple("x-html-obj-p", Object.create(HTMLParagraphElement.prototype), false);
+
+ // If prototype is an interface prototype object for any interface object,
+ // registration will throw.
+ testRegisterSimple("x-html-elem", HTMLElement.prototype, true);
+ testRegisterSimple("x-html-select", HTMLSelectElement.prototype, true);
+ testRegisterSimple("some-elem", HTMLElement.prototype, true);
+ testRegisterSimple("x-html-p", HTMLParagraphElement.prototype, true);
+ testRegisterSimple("x-html-span", HTMLSpanElement.prototype, true);
+
+ // 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.");
+
+ // Registering without a prototype should automatically create one inheriting from HTMLElement.
+ testRegisterSimple("x-elem-no-proto", null, false);
+
+ var simpleProto = Object.create(HTMLElement.prototype);
+ testRegisterSimple("x-elem-simple-proto", simpleProto, false);
+
+ // Test registering some invalid prototypes.
+ testRegisterSimple("x-invalid-number", 42, true);
+ testRegisterSimple("x-invalid-boolean", false, true);
+ testRegisterSimple("x-invalid-float", 1.0, true);
+ // A prototype with a non-configurable "constructor" property must throw.
+ var nonConfigProto = Object.create(HTMLElement.prototype,
+ { constructor: { configurable: false, value: function() {} } });
+ testRegisterSimple("x-non-config-proto", nonConfigProto, true);
+
+ // Test invalid custom element names.
+ testRegisterSimple("invalid", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("annotation-xml", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("color-profile", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("font-face", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("font-face-src", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("font-face-uri", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("font-face-format", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("font-face-name", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("missing-glyph", Object.create(HTMLElement.prototype), true);
+
+ // Test registering elements that extend from an existing element.
+ testRegisterExtend("x-extend-span", "span", Object.create(HTMLElement.prototype), false);
+ testRegisterExtend("x-extend-span-caps", "SPAN", Object.create(HTMLElement.prototype), false);
+
+ // Test registering elements that extend from a non-existing element.
+ testRegisterExtend("x-extend-span-nonexist", "nonexisting", Object.create(HTMLElement.prototype), true);
+
+ // Test registration with duplicate type.
+ testRegisterSimple("x-dupe-me", Object.create(HTMLElement.prototype), false);
+ testRegisterSimple("x-dupe-me", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("X-DUPE-ME", Object.create(HTMLElement.prototype), true);
+ testRegisterSimple("x-dupe-me", null, true);
+ testRegisterExtend("x-dupe-me", "span", Object.create(HTMLElement.prototype), true);
+
+ // document.createElement with extended type.
+ var extendedProto = Object.create(HTMLButtonElement.prototype);
+ var buttonConstructor = document.registerElement("x-extended-button", { prototype: extendedProto, 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__, extendedProto, "Created element should have the prototype of the extended type.");
+ is(extendedButton.getAttribute("is"), "x-extended-button", "The |is| attribute of the created element should be the extended type.");
+ is(extendedButton.type, "submit", "Created element should be a button with type of \"submit\"");
+
+ // document.createElementNS with different namespace than definition.
+ try {
+ var svgButton = document.createElementNS("http://www.w3.org/2000/svg", "button", {is: "x-extended-button"});
+ ok(false, "An exception should've been thrown");
+ } catch(err) {
+ is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
+ }
+
+ // document.createElementNS with no namespace.
+ try {
+ var noNamespaceButton = document.createElementNS("", "button", {is: "x-extended-button"});
+ ok(false, "An exception should've been thrown");
+ } catch(err) {
+ is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
+ }
+
+ // document.createElement with non-existant extended type.
+ try {
+ var normalButton = document.createElement("button", {is: "x-non-existant"});
+ ok(false, "An exception should've been thrown");
+ } catch(err) {
+ is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
+ }
+
+ // document.createElement with exteneded type that does not match with local name of element.
+ try {
+ var normalDiv = document.createElement("div", {is: "x-extended-button"});
+ ok(false, "An exception should've been thrown");
+ } catch(err) {
+ is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
+ }
+
+ // Custom element constructor.
+ var constructedButton = new buttonConstructor();
+ is(constructedButton.tagName, "BUTTON", "Created element should have local name of BUTTON");
+ is(constructedButton.__proto__, extendedProto, "Created element should have the prototype of the extended type.");
+ is(constructedButton.getAttribute("is"), "x-extended-button", "The |is| attribute of the created element should be the extended type.");
+
+ // document.createElement with different namespace than definition for extended element.
+ try {
+ var htmlText = document.createElement("text", {is: "x-extended-text"});
+ ok(false, "An exception should've been thrown");
+ } catch(err) {
+ is(err.name, "NotFoundError", "A NotFoundError exception should've been thrown");
+ }
+
+ // Try creating an element with a custom element name, but not in the html namespace.
+ var htmlNamespaceProto = Object.create(HTMLElement.prototype);
+ document.registerElement("x-in-html-namespace", { prototype: htmlNamespaceProto });
+ var wrongNamespaceElem = document.createElementNS("http://www.w3.org/2000/svg", "x-in-html-namespace");
+ isnot(wrongNamespaceElem.__proto__, htmlNamespaceProto, "Definition for element in html namespace should not apply to SVG elements.");
+}
+
+startTest();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_register_base_queue.html b/dom/tests/mochitest/webcomponents/test_document_register_base_queue.html
new file mode 100644
index 000000000..c839857b4
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_register_base_queue.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for document.registerElement lifecycle callback</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script>
+var p = Object.create(HTMLElement.prototype);
+
+var createdCallbackCallCount = 0;
+
+// By the time the base element queue is processed via the microtask,
+// both x-hello elements should be in the document.
+p.createdCallback = function() {
+ var one = document.getElementById("one");
+ var two = document.getElementById("two");
+ isnot(one, null, "First x-hello element should be in the tree.");
+ isnot(two, null, "Second x-hello element should be in the tree.");
+ createdCallbackCallCount++;
+ if (createdCallbackCallCount == 2) {
+ SimpleTest.finish();
+ }
+
+ if (createdCallbackCallCount > 2) {
+ ok(false, "Created callback called too much.");
+ }
+};
+
+p.attributeChangedCallback = function(name, oldValue, newValue) {
+ ok(false, "Attribute changed callback should not be called because callbacks should not be queued until created callback invoked.");
+};
+
+document.registerElement("x-hello", { prototype: p });
+
+SimpleTest.waitForExplicitFinish();
+</script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
+<x-hello id="one"></x-hello>
+<x-hello id="two"></x-hello>
+<script>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_register_lifecycle.html b/dom/tests/mochitest/webcomponents/test_document_register_lifecycle.html
new file mode 100644
index 000000000..9db9afbf4
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_register_lifecycle.html
@@ -0,0 +1,402 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for document.registerElement lifecycle callback</title>
+ <script type="text/javascript" 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 registering element type that is already in the document.
+// create element in document -> register -> remove from document
+function testRegisterUnresolved() {
+ var helloElem = document.getElementById("hello");
+
+ var createdCallbackCalled = false;
+ var attachedCallbackCalled = false;
+ var detachedCallbackCalled = false;
+
+ var p = Object.create(HTMLElement.prototype);
+ p.createdCallback = function() {
+ is(helloElem.__proto__, p, "Prototype should be adjusted just prior to invoking the created callback.");
+ is(createdCallbackCalled, false, "Created callback should only be called once in this tests.");
+ is(this, helloElem, "The 'this' value should be the custom element.");
+ createdCallbackCalled = true;
+ };
+
+ p.attachedCallback = function() {
+ is(createdCallbackCalled, true, "Created callback should be called before attached");
+ is(attachedCallbackCalled, false, "attached callback should only be called once in this test.");
+ is(this, helloElem, "The 'this' value should be the custom element.");
+ attachedCallbackCalled = true;
+ };
+
+ p.detachedCallback = function() {
+ is(attachedCallbackCalled, true, "attached callback should be called before detached");
+ is(detachedCallbackCalled, false, "detached callback should only be called once in this test.");
+ detachedCallbackCalled = true;
+ is(this, helloElem, "The 'this' value should be the custom element.");
+ runNextTest();
+ };
+
+ p.attributeChangedCallback = function(name, oldValue, newValue) {
+ ok(false, "attributeChanged callback should never be called in this test.");
+ };
+
+ document.registerElement("x-hello", { prototype: p });
+ is(createdCallbackCalled, true, "created callback should be called when control returns to script from user agent code");
+
+ // Remove element from document to trigger detached callback.
+ container.removeChild(helloElem);
+}
+
+// Tests callbacks after registering an extended element type that is already in the document.
+// create element in document -> register -> remove from document
+function testRegisterUnresolvedExtended() {
+ var buttonElem = document.getElementById("extbutton");
+
+ var createdCallbackCalled = false;
+ var attachedCallbackCalled = false;
+ var detachedCallbackCalled = false;
+
+ var p = Object.create(HTMLButtonElement.prototype);
+ p.createdCallback = function() {
+ is(buttonElem.__proto__, p, "Prototype should be adjusted just prior to invoking the created callback.");
+ is(createdCallbackCalled, false, "Created callback should only be called once in this tests.");
+ is(this, buttonElem, "The 'this' value should be the custom element.");
+ createdCallbackCalled = true;
+ };
+
+ p.attachedCallback = function() {
+ is(createdCallbackCalled, true, "Created callback should be called before attached");
+ is(attachedCallbackCalled, false, "attached callback should only be called once in this test.");
+ is(this, buttonElem, "The 'this' value should be the custom element.");
+ attachedCallbackCalled = true;
+ };
+
+ p.detachedCallback = function() {
+ is(attachedCallbackCalled, true, "attached callback should be called before detached");
+ is(detachedCallbackCalled, false, "detached callback should only be called once in this test.");
+ detachedCallbackCalled = true;
+ is(this, buttonElem, "The 'this' value should be the custom element.");
+ runNextTest();
+ };
+
+ p.attributeChangedCallback = function(name, oldValue, newValue) {
+ ok(false, "attributeChanged callback should never be called in this test.");
+ };
+
+ document.registerElement("x-button", { prototype: p, extends: "button" });
+ is(createdCallbackCalled, true, "created callback should be called when control returns to script from user agent code");
+
+ // Remove element from document to trigger detached callback.
+ container.removeChild(buttonElem);
+}
+
+function testInnerHTML() {
+ var createdCallbackCalled = false;
+
+ var p = Object.create(HTMLElement.prototype);
+ p.createdCallback = function() {
+ is(createdCallbackCalled, false, "created callback should only be called once in this test.");
+ createdCallbackCalled = true;
+ };
+
+ document.registerElement("x-inner-html", { prototype: p });
+ var div = document.createElement(div);
+ div.innerHTML = '<x-inner-html></x-inner-html>';
+ is(createdCallbackCalled, true, "created callback should be called after setting innerHTML.");
+ runNextTest();
+}
+
+function testInnerHTMLExtended() {
+ var createdCallbackCalled = false;
+
+ var p = Object.create(HTMLButtonElement.prototype);
+ p.createdCallback = function() {
+ is(createdCallbackCalled, false, "created callback should only be called once in this test.");
+ createdCallbackCalled = true;
+ };
+
+ document.registerElement("x-inner-html-extended", { prototype: p, extends: "button" });
+ var div = document.createElement(div);
+ div.innerHTML = '<button is="x-inner-html-extended"></button>';
+ is(createdCallbackCalled, true, "created callback should be called after setting innerHTML.");
+ runNextTest();
+}
+
+function testInnerHTMLUpgrade() {
+ var createdCallbackCalled = false;
+
+ var div = document.createElement(div);
+ div.innerHTML = '<x-inner-html-upgrade></x-inner-html-upgrade>';
+
+ var p = Object.create(HTMLElement.prototype);
+ p.createdCallback = function() {
+ is(createdCallbackCalled, false, "created callback should only be called once in this test.");
+ createdCallbackCalled = true;
+ };
+
+ document.registerElement("x-inner-html-upgrade", { prototype: p });
+ is(createdCallbackCalled, true, "created callback should be called after registering.");
+ runNextTest();
+}
+
+function testInnerHTMLExtendedUpgrade() {
+ var createdCallbackCalled = false;
+
+ var div = document.createElement(div);
+ div.innerHTML = '<button is="x-inner-html-extended-upgrade"></button>';
+
+ var p = Object.create(HTMLButtonElement.prototype);
+ p.createdCallback = function() {
+ is(createdCallbackCalled, false, "created callback should only be called once in this test.");
+ createdCallbackCalled = true;
+ };
+
+ document.registerElement("x-inner-html-extended-upgrade", { prototype: p, extends: "button" });
+ is(createdCallbackCalled, true, "created callback should be called after registering.");
+ runNextTest();
+}
+
+// Test callback when creating element after registering an element type.
+// register -> create element -> insert into document -> remove from document
+function testRegisterResolved() {
+ var createdCallbackCalled = false;
+ var attachedCallbackCalled = false;
+ var detachedCallbackCalled = false;
+
+ var createdCallbackThis;
+
+ var p = Object.create(HTMLElement.prototype);
+ p.createdCallback = function() {
+ is(createdCallbackCalled, false, "Created callback should only be called once in this test.");
+ createdCallbackThis = this;
+ createdCallbackCalled = true;
+ };
+
+ p.attachedCallback = function() {
+ is(createdCallbackCalled, true, "created callback should be called before attached callback.");
+ is(attachedCallbackCalled, false, "attached callback should only be called on in this test.");
+ is(this, createdElement, "The 'this' value should be the custom element.");
+ attachedCallbackCalled = true;
+ };
+
+ p.detachedCallback = function() {
+ is(attachedCallbackCalled, true, "attached callback should be called before detached");
+ is(detachedCallbackCalled, false, "detached callback should only be called once in this test.");
+ is(this, createdElement, "The 'this' value should be the custom element.");
+ detachedCallbackCalled = true;
+ runNextTest();
+ };
+
+ p.attributeChangedCallback = function() {
+ ok(false, "attributeChanged callback should never be called in this test.");
+ };
+
+ document.registerElement("x-resolved", { prototype: p });
+ is(createdCallbackCalled, false, "Created callback should not be called when custom element instance has not been created.");
+
+ var createdElement = document.createElement("x-resolved");
+ is(createdCallbackThis, createdElement, "The 'this' value in the created callback should be the custom element.");
+ is(createdElement.__proto__, p, "Prototype of custom element should be the registered 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 p = Object.create(HTMLElement.prototype);
+ var callbackCalled = false;
+ p.attributeChangedCallback = function(name, oldValue, newValue) {
+ is(callbackCalled, false, "Callback should only be called once in this test.");
+ callbackCalled = true;
+ runNextTest();
+ };
+
+ document.registerElement("x-test-callback", { prototype: p });
+
+ p.attributeChangedCallback = function(name, oldValue, newValue) {
+ ok(false, "Only callbacks at registration should be called.");
+ };
+
+ var elem = document.createElement("x-test-callback");
+ elem.setAttribute("foo", "bar");
+}
+
+function testAttributeChanged() {
+ var createdCallbackCalled = false;
+
+ var createdElement;
+ var createdCallbackThis;
+
+ var p = Object.create(HTMLElement.prototype);
+ p.createdCallback = function() {
+ is(createdCallbackCalled, false, "Created callback should only be called once in this test.");
+ createdCallbackThis = this;
+ createdCallbackCalled = true;
+ };
+
+ // 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.
+ ];
+
+ p.attributeChangedCallback = function(name, oldValue, newValue) {
+ is(createdCallbackCalled, true, "created callback should be called before attribute changed.");
+ is(this, createdElement, "The 'this' value should be the custom element.");
+ ok(expectedCallbackArguments.length > 0, "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();
+ }
+ };
+
+ document.registerElement("x-attrchange", { prototype: p });
+
+ var createdElement = document.createElement("x-attrchange");
+ is(createdCallbackThis, createdElement, "The 'this' value in the created callback should be the custom element.");
+ createdElement.setAttribute("changeme", "newvalue");
+ createdElement.setAttribute("changeme", "nextvalue");
+ createdElement.setAttribute("changeme", "");
+ createdElement.removeAttribute("changeme");
+}
+
+function testAttributeChangedExtended() {
+ var p = Object.create(HTMLButtonElement.prototype);
+ var callbackCalled = false;
+ p.attributeChangedCallback = function(name, oldValue, newValue) {
+ is(callbackCalled, false, "Callback should only be called once in this test.");
+ callbackCalled = true;
+ runNextTest();
+ };
+
+ document.registerElement("x-extended-attribute-change", { prototype: p, extends: "button" });
+
+ var elem = document.createElement("button", {is: "x-extended-attribute-change"});
+ elem.setAttribute("foo", "bar");
+}
+
+// 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() {
+ var p = Object.create(HTMLElement.prototype);
+
+ p.attached = function() {
+ ok(false, "attached should not be called when not entering the document.");
+ };
+
+ p.detached = function() {
+ ok(false, "leaveView should not be called when not leaving the document.");
+ };
+
+ var createdElement = document.createElement("x-destined-for-fragment");
+
+ document.registerElement("x-destined-for-fragment", { prototype: p });
+
+ 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 attachedCallbackCalled = false;
+ var detachedCallbackCalled = false;
+
+ var p = Object.create(HTMLElement.prototype);
+ p.attachedCallback = function() {
+ is(attachedCallbackCalled, false, "attached callback should only be called on in this test.");
+ attachedCallbackCalled = true;
+ };
+
+ p.detachedCallback = function() {
+ is(attachedCallbackCalled, true, "attached callback should be called before detached");
+ is(detachedCallbackCalled, false, "detached callback should only be called once in this test.");
+ detachedCallbackCalled = true;
+ runNextTest();
+ };
+
+ var div = document.createElement("div");
+ document.registerElement("x-element-in-div", { prototype: p });
+ var customElement = document.createElement("x-element-in-div");
+ div.appendChild(customElement);
+ is(attachedCallbackCalled, false, "Appending a custom element to a node that is not in the document should not call the attached callback.");
+
+ container.appendChild(div);
+ container.removeChild(div);
+}
+
+var testFunctions = [
+ testRegisterUnresolved,
+ testRegisterUnresolvedExtended,
+ testInnerHTML,
+ testInnerHTMLExtended,
+ testInnerHTMLUpgrade,
+ testInnerHTMLExtendedUpgrade,
+ testRegisterResolved,
+ testAttributeChanged,
+ testAttributeChangedExtended,
+ testUpgradeCandidate,
+ testChangingCallback,
+ testNotInDocEnterLeave,
+ testEnterLeaveView,
+ SimpleTest.finish
+];
+
+function runNextTest() {
+ if (testFunctions.length > 0) {
+ var nextTestFunction = testFunctions.shift();
+ nextTestFunction();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+runNextTest();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_register_parser.html b/dom/tests/mochitest/webcomponents/test_document_register_parser.html
new file mode 100644
index 000000000..bc4cdcbac
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_register_parser.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for document.registerElement for elements created by the parser</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script>
+
+var extendedButtonProto = Object.create(HTMLButtonElement.prototype);
+var buttonCallbackCalled = false;
+extendedButtonProto.createdCallback = function() {
+ is(buttonCallbackCalled, false, "created callback for x-button should only be called once.");
+ is(this.tagName, "BUTTON", "Only the <button> element should be upgraded.");
+ buttonCallbackCalled = true;
+};
+
+document.registerElement("x-button", { prototype: extendedButtonProto, extends: "button" });
+
+var divProto = Object.create(HTMLDivElement.prototype);
+var divCallbackCalled = false;
+divProto.createdCallback = function() {
+ is(divCallbackCalled, false, "created callback for x-div should only be called once.");
+ is(buttonCallbackCalled, true, "crated callback should be called for x-button before x-div.");
+ is(this.tagName, "X-DIV", "Only the <x-div> element should be upgraded.");
+ divCallbackCalled = true;
+ SimpleTest.finish();
+};
+
+document.registerElement("x-div", { prototype: divProto });
+
+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 -->
+<script>
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_register_stack.html b/dom/tests/mochitest/webcomponents/test_document_register_stack.html
new file mode 100644
index 000000000..34f108654
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_register_stack.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test for document.registerElement lifecycle callback</title>
+ <script type="text/javascript" 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");
+
+// Test changing attributes in the created callback on an element
+// created after registration.
+function testChangeAttributeInCreatedCallback() {
+ var createdCallbackCalled = false;
+ var attributeChangedCallbackCalled = false;
+
+ var p = Object.create(HTMLElement.prototype);
+ p.createdCallback = function() {
+ is(createdCallbackCalled, false, "Created callback should be called before attached callback.");
+ createdCallbackCalled = true;
+ is(attributeChangedCallbackCalled, false, "Attribute changed callback should not have been called prior to setting the attribute.");
+ this.setAttribute("foo", "bar");
+ is(attributeChangedCallbackCalled, false, "While element is being created, element should not be added to the current element callback queue.");
+ };
+
+ p.attributeChangedCallback = function(name, oldValue, newValue) {
+ is(createdCallbackCalled, true, "attributeChanged callback should be called after the created callback because it was enqueued during created callback.");
+ is(attributeChangedCallbackCalled, false, "attributeChanged callback should only be called once in this tests.");
+ is(newValue, "bar", "The new value should be 'bar'");
+ attributeChangedCallbackCalled = true;
+ runNextTest();
+ };
+
+ document.registerElement("x-one", { prototype: p });
+ document.createElement("x-one");
+}
+
+function testChangeAttributeInEnteredViewCallback() {
+ var p = Object.create(HTMLElement.prototype);
+ var attributeChangedCallbackCalled = false;
+ var attachedCallbackCalled = false;
+
+ p.attachedCallback = function() {
+ is(attachedCallbackCalled, false, "attached callback should be called only once in this test.");
+ attachedCallbackCalled = 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();
+ };
+
+ p.attributeChangedCallback = function() {
+ is(attachedCallbackCalled, true, "attached callback should have been called prior to attribute changed callback.");
+ is(attributeChangedCallbackCalled, false, "attributeChanged callback should only be called once in this tests.");
+ attributeChangedCallbackCalled = true;
+ };
+
+ document.registerElement("x-two", { prototype: p });
+ var elem = document.createElement("x-two");
+
+ var container = document.getElementById("container");
+ container.appendChild(elem);
+}
+
+function testLeaveViewInEnteredViewCallback() {
+ var p = Object.create(HTMLElement.prototype);
+ var attachedCallbackCalled = false;
+ var detachedCallbackCalled = false;
+ var container = document.getElementById("container");
+
+ p.attachedCallback = function() {
+ is(this.parentNode, container, "Parent node should the container in which the node was appended.");
+ is(attachedCallbackCalled, false, "attached callback should be called only once in this test.");
+ attachedCallbackCalled = true;
+ is(detachedCallbackCalled, false, "detached callback should not be called prior to removing element from document.");
+ container.removeChild(this);
+ is(detachedCallbackCalled, true, "Transition from user-agent implementation to script should run left view callback.");
+ runNextTest();
+ };
+
+ p.detachedCallback = function() {
+ is(detachedCallbackCalled, false, "The detached callback should only be called once in this test.");
+ is(attachedCallbackCalled, true, "The attached callback should be called prior to detached callback.");
+ detachedCallbackCalled = true;
+ };
+
+ document.registerElement("x-three", { prototype: p });
+ var elem = document.createElement("x-three");
+
+ container.appendChild(elem);
+}
+
+function testStackedAttributeChangedCallback() {
+ var p = Object.create(HTMLElement.prototype);
+ var attributeChangedCallbackCount = 0;
+
+ var attributeSequence = ["foo", "bar", "baz"];
+
+ p.attributeChangedCallback = function(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();
+ }
+ };
+
+ document.registerElement("x-four", { prototype: p });
+ var elem = document.createElement("x-four");
+ elem.setAttribute("foo", "changeme");
+}
+
+var testFunctions = [
+ testChangeAttributeInCreatedCallback,
+ testChangeAttributeInEnteredViewCallback,
+ testLeaveViewInEnteredViewCallback,
+ testStackedAttributeChangedCallback,
+ SimpleTest.finish
+];
+
+function runNextTest() {
+ if (testFunctions.length > 0) {
+ var nextTestFunction = testFunctions.shift();
+ nextTestFunction();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+
+runNextTest();
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_document_shared_registry.html b/dom/tests/mochitest/webcomponents/test_document_shared_registry.html
new file mode 100644
index 000000000..76c2ea8ec
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_document_shared_registry.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=783129
+-->
+<head>
+ <title>Test shared registry for associated HTML documents.</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="container"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
+<script>
+var container = document.getElementById("container");
+
+function createdCallbackFromMainDoc() {
+ var createdCallbackCalled = false;
+ var assocDoc = document.implementation.createHTMLDocument();
+
+ var proto = Object.create(HTMLElement.prototype);
+ proto.createdCallback = function() {
+ is(createdCallbackCalled, false, "created callback should only be called once in this tests.");
+ createdCallbackCalled = true;
+ runNextTest();
+ };
+
+ assocDoc.registerElement("x-associated-doc-callback-elem", { prototype: proto });
+ document.createElement("x-associated-doc-callback-elem");
+}
+
+function createdCallbackFromDocHTMLNamespace() {
+ var createdCallbackCalled = false;
+ var assocDoc = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null);
+ var somediv = assocDoc.createElement("div");
+
+ var proto = Object.create(HTMLElement.prototype);
+ proto.createdCallback = function() {
+ is(createdCallbackCalled, false, "created callback should only be called once in this tests.");
+ createdCallbackCalled = true;
+ runNextTest();
+ };
+
+ assocDoc.registerElement("x-assoc-doc-with-ns-callback-elem", { prototype: proto });
+ document.createElement("x-assoc-doc-with-ns-callback-elem");
+}
+
+function registerNoRegistryDoc() {
+ var assocDoc = document.implementation.createDocument(null, "html");
+ try {
+ assocDoc.registerElement("x-dummy", { prototype: Object.create(HTMLElement.prototype) });
+ ok(false, "Registring element in document without registry should throw.");
+ } catch (ex) {
+ ok(true, "Registring element in document without registry should throw.");
+ }
+
+ runNextTest();
+}
+
+function runNextTest() {
+ if (testFunctions.length > 0) {
+ var nextTestFunction = testFunctions.shift();
+ nextTestFunction();
+ }
+}
+
+var testFunctions = [
+ createdCallbackFromMainDoc,
+ createdCallbackFromDocHTMLNamespace,
+ registerNoRegistryDoc,
+ SimpleTest.finish
+];
+
+SimpleTest.waitForExplicitFinish();
+
+runNextTest();
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html b/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html
new file mode 100644
index 000000000..c9af76610
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for dynamic changes to content matching content elements</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div class="tall" id="bodydiv"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+// Create ShadowRoot.
+var elem = document.createElement("div");
+var root = elem.createShadowRoot();
+
+var redInsertionPoint = document.createElement("content");
+redInsertionPoint.select = "*[data-color=red]";
+
+var blueInsertionPoint = document.createElement("content");
+blueInsertionPoint.select = "*[data-color=blue]";
+
+root.appendChild(redInsertionPoint);
+root.appendChild(blueInsertionPoint);
+
+is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes.");
+is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should have no distrubted nodes.");
+
+var matchElement = document.createElement("div");
+matchElement.setAttribute("data-color", "red");
+elem.appendChild(matchElement);
+
+is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes.");
+is(redInsertionPoint.getDistributedNodes().length, 1, "Red insertion point should match recently inserted div.");
+
+matchElement.setAttribute("data-color", "blue");
+is(blueInsertionPoint.getDistributedNodes().length, 1, "Blue insertion point should match element after changing attribute value.");
+is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should not match element after changing attribute value.");
+
+matchElement.removeAttribute("data-color");
+
+is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes after removing the matching attribute.");
+is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should have no distrubted nodes after removing the matching attribute.");
+
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/webcomponents/test_event_dispatch.html b/dom/tests/mochitest/webcomponents/test_event_dispatch.html
new file mode 100644
index 000000000..c73bfb214
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_event_dispatch.html
@@ -0,0 +1,458 @@
+<!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="/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);
+
+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);
+ }
+
+ // Check to make sure the event chain matches what we get back from nsIEventListenerService.getEventTargetChainFor
+ if (0 < actual.length) {
+ var chain = els.getEventTargetChainFor(actual[0], true); // Events should be dispatched on actual[0].
+ for (var i = 0; i < expected.length; i++) {
+ ok(SpecialPowers.compare(chain[i], expected[i]), msg + " at " + i + " for nsIEventListenerService");
+ }
+ }
+}
+
+/*
+ * Test 1: Test of event dispatch through a basic ShadowRoot with content a insertion point.
+ *
+ * <div elemOne> ------ <shadow-root shadowOne>
+ * | |
+ * <div elemTwo> <span elemThree>
+ * |
+ * <content elemFour>
+ */
+
+var elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+var elemTwo = document.createElement("div");
+elemTwo.addEventListener("custom", eventListener);
+
+var elemThree = document.createElement("span");
+elemThree.addEventListener("custom", eventListener);
+
+var elemFour = document.createElement("content");
+elemFour.addEventListener("custom", eventListener);
+
+var shadowOne = elemOne.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+elemThree.appendChild(elemFour);
+shadowOne.appendChild(elemThree);
+elemOne.appendChild(elemTwo);
+
+var eventChain = [];
+var customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemTwo.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemTwo, elemFour, elemThree, shadowOne, elemOne], "Event path for test 1 for event dispatched on elemTwo.");
+
+/*
+ * Test 2: Test of event dispatch through a nested ShadowRoots with content insertion points.
+ *
+ * <div elemFive> --- <shadow-root shadowTwo>
+ * | |
+ * <div elemOne> <div elemFour> ----- <shadow-root shadowOne>
+ * | |
+ * <content elemTwo> <p elemSix>
+ * |
+ * <content elemThree>
+ */
+
+elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+elemTwo = document.createElement("content");
+elemTwo.addEventListener("custom", eventListener);
+
+elemThree = document.createElement("content");
+elemThree.addEventListener("custom", eventListener);
+
+var elemFour = document.createElement("div");
+elemFour.addEventListener("custom", eventListener);
+
+var elemFive = document.createElement("div");
+elemFive.addEventListener("custom", eventListener);
+
+var elemSix = document.createElement("p");
+elemSix.addEventListener("custom", eventListener);
+
+var shadowOne = elemFour.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+var shadowTwo = elemFive.createShadowRoot();
+shadowTwo.addEventListener("custom", eventListener);
+
+elemFive.appendChild(elemOne);
+shadowTwo.appendChild(elemFour);
+elemFour.appendChild(elemTwo);
+shadowOne.appendChild(elemSix);
+elemSix.appendChild(elemThree);
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemOne.dispatchEvent(customEvent);
+is(elemOne.getDestinationInsertionPoints().length, 2, "yes");
+isEventChain(eventChain, [elemOne, elemThree, elemSix, shadowOne, elemTwo, elemFour, shadowTwo, elemFive], "Event path for test 2 for event dispatched on elemOne.");
+
+/*
+ * Test 3: Test of event dispatch through nested ShadowRoot with content insertion points.
+ *
+ * <div elemOne> ------- <shadow-root shadowOne>
+ * | |
+ * <span elemTwo> <span elemThree> ------------ <shadow-root shadowTwo>
+ * | |
+ * <span elemFour> <content elemSix>
+ * |
+ * <content elemFive>
+ */
+
+elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+elemTwo = document.createElement("span");
+elemTwo.addEventListener("custom", eventListener);
+
+elemThree = document.createElement("span");
+elemThree.addEventListener("custom", eventListener);
+
+elemFour = document.createElement("span");
+elemFour.addEventListener("custom", eventListener);
+
+elemFive = document.createElement("content");
+elemFive.addEventListener("custom", eventListener);
+
+elemSix = document.createElement("content");
+elemSix.addEventListener("custom", eventListener);
+
+shadowOne = elemOne.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+shadowTwo = elemThree.createShadowRoot();
+shadowTwo.addEventListener("custom", eventListener);
+
+elemOne.appendChild(elemTwo);
+shadowOne.appendChild(elemThree);
+elemThree.appendChild(elemFour);
+elemFour.appendChild(elemFive);
+shadowTwo.appendChild(elemSix);
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemTwo.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemTwo, elemFive, elemFour, elemSix, shadowTwo, elemThree, shadowOne, elemOne], "Event path for test 3 for event dispatched on elemTwo.");
+
+/*
+ * Test 4: Test of event dispatch through host with multiple ShadowRoots with shadow insertion point.
+ *
+ * <div elemSeven> --- <shadow-root shadowTwo> (younger ShadowRoot)
+ * | | |
+ * <div elemOne> | <div elemSix> -------- <shadow-root shadowOne>
+ * | | |
+ * | <shadow elemFour> <content elemFive>
+ * | |
+ * | <content elemTwo>
+ * |
+ * --- <shadow-root shadowThree> (older ShadowRoot)
+ * | |
+ * | <content elemThree>
+ * |
+ * <div elemEight>
+ */
+
+elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+elemTwo = document.createElement("content");
+elemTwo.addEventListener("custom", eventListener);
+
+elemThree = document.createElement("content");
+elemThree.addEventListener("custom", eventListener);
+
+elemFour = document.createElement("shadow");
+elemFour.addEventListener("custom", eventListener);
+
+elemFive = document.createElement("content");
+elemFive.addEventListener("custom", eventListener);
+
+elemSix = document.createElement("div");
+elemSix.addEventListener("custom", eventListener);
+
+var elemSeven = document.createElement("div");
+elemSeven.addEventListener("custom", eventListener);
+
+var elemEight = document.createElement("div");
+elemEight.addEventListener("custom", eventListener);
+
+var shadowThree = elemSeven.createShadowRoot();
+shadowThree.addEventListener("custom", eventListener);
+
+shadowTwo = elemSeven.createShadowRoot();
+shadowTwo.addEventListener("custom", eventListener);
+
+shadowOne = elemSix.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+elemSeven.appendChild(elemOne);
+shadowTwo.appendChild(elemSix);
+elemSix.appendChild(elemFour);
+elemFour.appendChild(elemTwo);
+shadowThree.appendChild(elemEight);
+shadowThree.appendChild(elemThree);
+shadowOne.appendChild(elemFive);
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemOne.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemOne, elemFive, shadowOne, elemThree, shadowThree, elemTwo, elemFour, elemSix, shadowTwo, elemSeven], "Event path for test 4 for event dispatched on elemOne.");
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemEight.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemEight, elemFive, shadowOne, elemSix, shadowTwo, elemSeven], "Event path for test 4 for event dispatched on elemEight.");
+
+/*
+ * Test 5: Test of event dispatch through nested shadowroot with insertion points that match specific tags.
+ *
+ * <div elemOne> --------- <shadow-root shadowOne>
+ * | | |
+ * | <p elemThree> <span elemFour> ------------------------ <shadow-root shadowTwo>
+ * | | | |
+ * <span elemTwo> | <content select="p" elemFive> <content elemSeven>
+ * |
+ * <content select="span" elemSix>
+ */
+
+elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+elemTwo = document.createElement("span");
+elemTwo.addEventListener("custom", eventListener);
+
+elemThree = document.createElement("p");
+elemThree.addEventListener("custom", eventListener);
+
+elemFour = document.createElement("span");
+elemFour.addEventListener("custom", eventListener);
+
+elemFive = document.createElement("content");
+elemFive.select = "p";
+elemFive.addEventListener("custom", eventListener);
+
+elemSix = document.createElement("content");
+elemSix.select = "span";
+elemSix.addEventListener("custom", eventListener);
+
+elemSeven = document.createElement("content");
+elemSeven.addEventListener("custom", eventListener);
+
+shadowTwo = elemFour.createShadowRoot();
+shadowTwo.addEventListener("custom", eventListener);
+
+shadowOne = elemOne.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+elemOne.appendChild(elemTwo);
+elemOne.appendChild(elemThree);
+shadowOne.appendChild(elemFour);
+elemFour.appendChild(elemSix);
+elemFour.appendChild(elemFive);
+shadowTwo.appendChild(elemSeven);
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemTwo.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemTwo, elemSeven, shadowTwo, elemSix, elemFour, shadowOne, elemOne], "Event path for test 5 for event dispatched on elemTwo.");
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemThree.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemThree, elemSeven, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 5 for event dispatched on elemThree.");
+
+/*
+ * Test 6: Test of event dispatch through nested shadowroot with insertion points that match specific tags.
+ *
+ * <div elemOne> --------- <shadow-root shadowOne>;
+ * | | |
+ * | <p elemThree> <span elemFour> ------ <shadow-root shadowTwo>
+ * | | | |
+ * <span elemTwo> <content elemFive> | <content select="p" elemSeven>
+ * |
+ * <content select="span" elemSix>
+ */
+
+elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+elemTwo = document.createElement("span");
+elemTwo.addEventListener("custom", eventListener);
+
+elemThree = document.createElement("p");
+elemThree.addEventListener("custom", eventListener);
+
+elemFour = document.createElement("span");
+elemFour.addEventListener("custom", eventListener);
+
+elemFive = document.createElement("content");
+elemFive.addEventListener("custom", eventListener);
+
+elemSix = document.createElement("content");
+elemSix.select = "span";
+elemSix.addEventListener("custom", eventListener);
+
+elemSeven = document.createElement("content");
+elemSeven.select = "p";
+elemSeven.addEventListener("custom", eventListener);
+
+shadowTwo = elemFour.createShadowRoot();
+shadowTwo.addEventListener("custom", eventListener);
+
+shadowOne = elemOne.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+elemOne.appendChild(elemTwo);
+elemOne.appendChild(elemThree);
+shadowOne.appendChild(elemFour);
+elemFour.appendChild(elemFive);
+shadowTwo.appendChild(elemSix);
+shadowTwo.appendChild(elemSeven);
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemTwo.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemTwo, elemSix, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 6 for event dispatched on elemTwo.");
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemThree.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemThree, elemSeven, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 6 for event dispatched on elemThree.");
+
+/*
+ * Test 7: Test of event dispatch through nested shadowroot with insertion points that match specific tags.
+ *
+ * <div elemOne> --------- <shadow-root shadowOne>
+ * | | |
+ * | <p elemThree> <span elemFour> ------ <shadow-root shadowTwo>
+ * | | |
+ * <span elemTwo> <content elemFive> <span elemEight>
+ * | |
+ * | <content select="p" elemSeven>
+ * |
+ * <content select="span" elemSix>
+ */
+
+elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+elemTwo = document.createElement("span");
+elemTwo.addEventListener("custom", eventListener);
+
+elemThree = document.createElement("p");
+elemThree.addEventListener("custom", eventListener);
+
+elemFour = document.createElement("span");
+elemFour.addEventListener("custom", eventListener);
+
+elemFive = document.createElement("content");
+elemFive.addEventListener("custom", eventListener);
+
+elemSix = document.createElement("content");
+elemSix.select = "span";
+elemSix.addEventListener("custom", eventListener);
+
+elemSeven = document.createElement("content");
+elemSeven.select = "p";
+elemSeven.addEventListener("custom", eventListener);
+
+elemEight = document.createElement("span");
+elemEight.addEventListener("custom", eventListener);
+
+shadowTwo = elemFour.createShadowRoot();
+shadowTwo.addEventListener("custom", eventListener);
+
+shadowOne = elemOne.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+elemOne.appendChild(elemTwo);
+elemOne.appendChild(elemThree);
+shadowOne.appendChild(elemFour);
+elemFour.appendChild(elemFive);
+shadowTwo.appendChild(elemEight);
+elemEight.appendChild(elemSix);
+elemEight.appendChild(elemSeven);
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemTwo.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemTwo, elemSix, elemEight, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 7 for event dispatched on elemTwo.");
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemThree.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemThree, elemSeven, elemEight, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 7 for event dispatched on elemThree.");
+
+/*
+ * Test 8: Test of event dispatch through host with multiple ShadowRoots with shadow insertion point.
+ *
+ * <div elemOne> --- <shadow-root shadowOne> (younger ShadowRoot)
+ * | |
+ * | <div elemFour>
+ * | |
+ * | <shadow elemTwo>
+ * |
+ * --- <shadow-root shadowTwo> (older ShadowRoot)
+ * |
+ * <div elemThree>
+ */
+
+elemOne = document.createElement("div");
+elemOne.addEventListener("custom", eventListener);
+
+elemTwo = document.createElement("shadow");
+elemTwo.addEventListener("custom", eventListener);
+
+elemThree = document.createElement("div");
+elemThree.addEventListener("custom", eventListener);
+
+elemFour = document.createElement("div");
+elemFour.addEventListener("custom", eventListener);
+
+shadowTwo = elemOne.createShadowRoot();
+shadowTwo.addEventListener("custom", eventListener);
+
+shadowOne = elemOne.createShadowRoot();
+shadowOne.addEventListener("custom", eventListener);
+
+shadowOne.appendChild(elemFour);
+elemFour.appendChild(elemTwo);
+shadowTwo.appendChild(elemThree);
+
+eventChain = [];
+customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true });
+elemThree.dispatchEvent(customEvent);
+isEventChain(eventChain, [elemThree, shadowTwo, elemTwo, elemFour, shadowOne, elemOne], "Event path for test 8 for event dispatched on elemThree.");
+
+</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 000000000..ed81faf48
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_event_retarget.html
@@ -0,0 +1,147 @@
+<!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="/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>
+
+/*
+ * 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 = document.createElement("div");
+var elemTwo = document.createElement("content");
+var elemThree = document.createElement("div");
+var shadowOne = elemThree.createShadowRoot();
+
+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 = document.createElement("div");
+elemTwo = document.createElement("content");
+elemThree = document.createElement("div");
+shadowOne = elemThree.createShadowRoot();
+
+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 = document.createElement("div");
+elemTwo = document.createElement("content");
+elemThree = document.createElement("content");
+var elemFour = document.createElement("div");
+var elemFive = document.createElement("div");
+var shadowTwo = elemFive.createShadowRoot();
+shadowOne = elemFour.createShadowRoot();
+
+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 = document.createElement("div");
+elemTwo = document.createElement("content");
+elemThree = document.createElement("content");
+elemFour = document.createElement("div");
+elemFive = document.createElement("div");
+shadowTwo = elemFive.createShadowRoot();
+shadowOne = elemFour.createShadowRoot();
+
+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);
+
+</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 000000000..970e44039
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_event_stopping.html
@@ -0,0 +1,168 @@
+<!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="/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);
+
+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 (0 < 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 = document.createElement("div");
+var elemTwo = document.createElement("span");
+var elemThree = document.createElement("span");
+var shadowOne = elemOne.createShadowRoot();
+
+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.");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html b/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
new file mode 100644
index 000000000..4eefa165f
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=999999
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 999999</title>
+ <script type="application/javascript" 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=999999">Mozilla Bug 999999</a>
+<p id="display"></p>
+<div id="content">
+<div id="shadowhost"></div>
+</div>
+<pre id="test">
+</pre>
+<script type="application/javascript">
+
+/** Test for Bug 999999 **/
+var host = document.getElementById("shadowhost");
+
+// Test destination insertion points of node distributed to content element.
+var shadowRoot = host.createShadowRoot();
+shadowRoot.innerHTML = '<div id="innerhost"><content id="innercontent"></content></div>';
+
+var fallback = document.createElement("span");
+var innerContent = shadowRoot.getElementById("innercontent");
+
+innerContent.appendChild(fallback);
+
+is(fallback.getDestinationInsertionPoints().length, 1, "Active fallback content should be distributed to insertion point.");
+is(fallback.getDestinationInsertionPoints()[0], innerContent, "Insertion point should be in list of destination insertion points.");
+
+// Test destination insertion points of reprojected fallback content.
+var innerHost = shadowRoot.getElementById("innerhost");
+var innerShadowRoot = innerHost.createShadowRoot();
+innerShadowRoot.innerHTML = '<content id="innerinnercontent"></content>';
+
+var innerInnerContent = innerShadowRoot.getElementById("innerinnercontent");
+
+is(fallback.getDestinationInsertionPoints().length, 2, "Fallback content should have been distributed into parent and reprojected into another insertion point.");
+is(fallback.getDestinationInsertionPoints()[1], innerInnerContent, "Destination insertion points should contain content element to which the node was reprojected.");
+
+// Test destination insertion points of fallback content that was dropped due to content element matching a node in the host.
+var span = document.createElement("span");
+host.appendChild(span);
+
+is(fallback.getDestinationInsertionPoints().length, 0, "After dropping insertion points, fallback content should not have any nodes in destination insertion points list.");
+
+// Test destination insertion points of fallback content after reactivating by dropping matched content on host.
+host.removeChild(span);
+is(fallback.getDestinationInsertionPoints().length, 2, "Fallback content should have 2 destination insertion points after being reactivated.");
+is(fallback.getDestinationInsertionPoints()[0], innerContent, "First destination insertion point should be the parent content");
+is(fallback.getDestinationInsertionPoints()[1], innerInnerContent, "Second destination insertion point should be the content to which the node is reprojected.");
+
+// Test destination insertion points of fallback content after removed from the tree.
+innerContent.removeChild(fallback);
+is(fallback.getDestinationInsertionPoints().length, 0, "Fallback content is no longer fallback content, destination insertion points should be empty.");
+
+// Test destination insertion points of child of non-insertion point content element.
+var notInsertionPointContent = document.createElement("content");
+var notFallback = document.createElement("span");
+notInsertionPointContent.appendChild(notFallback);
+is(notFallback.getDestinationInsertionPoints().length, 0, "Child of non-insertion point content should not be distributed to any nodes.");
+
+</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 000000000..824b9e5ff
--- /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 type="text/javascript" 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", null, null);
+ prefetch.cancelPrefetchURI(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", null, null);
+ prefetch.cancelPrefetchURI(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_nested_content_element.html b/dom/tests/mochitest/webcomponents/test_nested_content_element.html
new file mode 100644
index 000000000..1d98d2996
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_nested_content_element.html
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for HTMLContent element</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="grabme"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+
+/**
+ * Constructs a node with a nested ShadowRoot with the following structure:
+ * <span> - - - - - - - - - - <ShadowRoot>
+ * <span> <span> - - - - - - - - - - <ShadowRoot>
+ * id=one id=four <span>
+ * data-color=red data-color=orange id=eleven
+ * <span> <span> <content>
+ * id=two id=five id=twelve
+ * data-color=blue data-color=purple select=secondSelect
+ * <span> <content> <span>
+ * id=three id=six id=thirteen
+ * data-color=green select=firstSelect
+ * <span>
+ * id=seven
+ * <content>
+ * id=eight
+ * <span>
+ * id=nine
+ * <span>
+ * id=ten
+ * data-color=grey
+ */
+function constructTree(firstSelect, secondSelect) {
+ var rootSpan = document.createElement("span");
+ rootSpan.innerHTML = '<span id="one" data-color="red"></span><span id="two" data-color="blue"></span><span id="three" data-color="green"></span>';
+ var firstShadow = rootSpan.createShadowRoot();
+ firstShadow.innerHTML = '<span id="four" data-color="orange"><span id="five" data-color="purple"></span><content id="six" select="' + firstSelect + '"><span id="seven"></span><content id="eight"></content><span id="nine"></span></content><span id="ten"></span></span>';
+ var secondShadow = firstShadow.firstChild.createShadowRoot();
+ secondShadow.innerHTML = '<span id="eleven"></span><content id="twelve" select="' + secondSelect + '"></content><span id="thirteen"></span>';
+ return rootSpan;
+}
+
+// Create a tree with content that matches on everything and check node distribution.
+var allSpan = constructTree("*", "*");
+var firstContent = allSpan.shadowRoot.getElementById("six");
+var firstDistNodes = firstContent.getDistributedNodes();
+is(firstDistNodes.length, 3, "Universal selector should match all nodes.");
+// Check the order of the distributed nodes.
+is(firstDistNodes.item(0).id, "one", "First distributed node should have id of 'one'");
+is(firstDistNodes.item(1).id, "two", "Second distributed node should have id of 'two'");
+is(firstDistNodes.item(2).id, "three", "Third distributed node should have id of 'three'");
+var secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
+var secondDistNodes = secondContent.getDistributedNodes();
+is(secondDistNodes.length, 5, "Universial selector should match all nodes including those distributed into content.");
+// Check the order of the distribute nodes.
+is(secondDistNodes.item(0).id, "five", "First distributed node should have id of 'five'");
+is(secondDistNodes.item(1).id, "one", "Second distributed (reprojected) node should have id of 'one'");
+is(secondDistNodes.item(2).id, "two", "Third distributed (reprojected) node should have id of 'two'");
+is(secondDistNodes.item(3).id, "three", "Fourth distributed (reprojected) node should have id of 'three'");
+is(secondDistNodes.item(4).id, "ten", "Fifth distributed node should have id of 'ten'");
+
+// Append an element after id=two and make sure that it is inserted into the corrent
+// position in the insertion points.
+var additionalSpan = document.createElement("span");
+additionalSpan.id = "additional";
+
+// Insert the additional span in the third position, before the span with id=three.
+allSpan.insertBefore(additionalSpan, allSpan.childNodes.item(2));
+firstDistNodes = firstContent.getDistributedNodes();
+secondDistNodes = secondContent.getDistributedNodes();
+is(firstDistNodes.length, 4, "First insertion point should match one more node.");
+is(firstDistNodes.item(2).id, "additional", "Additional span should have been inserted into the third position of the first insertion point.");
+
+is(secondDistNodes.length, 6, "Second insertion point should match one more node.");
+is(secondDistNodes.item(3).id, "additional", "Additional span should have been inserted into the fourth position of the second insertion point.");
+
+function nodeListDoesNotContain(nodeList, element) {
+ for (var i = 0; i < nodeList.length; i++) {
+ if (nodeList[i] == element) {
+ return false;
+ }
+ }
+ return true;
+}
+
+// Remove the span with id=one and check that it is removed from all insertion points.
+allSpan = constructTree("*", "*");
+var spanOne = allSpan.firstChild;
+allSpan.removeChild(spanOne);
+firstContent = allSpan.shadowRoot.getElementById("six");
+ok(nodeListDoesNotContain(firstContent.getDistributedNodes(), spanOne), "Child removed from host should not appear in insertion point node list.");
+secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
+ok(nodeListDoesNotContain(secondContent.getDistributedNodes(), spanOne), "Child removed from host should not appear in nested insertion point node list.");
+
+// Make sure <content> in fallback content is inactive.
+// First insertion point will not match anything and will use fallback content.
+allSpan = constructTree("#nomatch", "*");
+var fallbackInsertionPoint = allSpan.shadowRoot.getElementById("eight");
+is(fallbackInsertionPoint.getDistributedNodes().length, 0, "Insertion points in default content should be inactive.");
+
+// Insertion points with non-universal selectors.
+allSpan = constructTree("span[data-color=blue]", "*");
+firstContent = allSpan.shadowRoot.getElementById("six");
+is(firstContent.getDistributedNodes().length, 1, "Insertion point selector should only match one node.");
+is(firstContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector.");
+secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
+is(secondContent.getDistributedNodes().length, 3, "Second insertion point should match two children and one reprojected node.");
+is(secondContent.getDistributedNodes()[1].dataset.color, "blue", "Projected node should match selector.");
+
+allSpan = constructTree("span[data-color=blue]", "span[data-color=blue]");
+firstContent = allSpan.shadowRoot.getElementById("six");
+is(firstContent.getDistributedNodes().length, 1, "Insertion point selector should only match one node.");
+is(firstContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector.");
+secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
+is(secondContent.getDistributedNodes().length, 1, "Insertion point should only match reprojected node.");
+is(secondContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector.");
+
+// Make sure that dynamically appended default content will get distributed.
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/webcomponents/test_shadow_element.html b/dom/tests/mochitest/webcomponents/test_shadow_element.html
new file mode 100644
index 000000000..4440650d7
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadow_element.html
@@ -0,0 +1,173 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=887538
+-->
+<head>
+ <title>Test for HTMLShadowElement</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="grabme"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887538">Bug 887538</a>
+<script>
+var host = document.createElement("span");
+
+// Create three shadow roots on a single host and make sure that shadow elements
+// are associated with the correct shadow root.
+var firstShadow = host.createShadowRoot();
+firstShadow.innerHTML = '<shadow id="shadowone"></shadow>';
+var secondShadow = host.createShadowRoot();
+secondShadow.innerHTML = '<shadow id="shadowtwo"></shadow>';
+var thirdShadow = host.createShadowRoot();
+thirdShadow.innerHTML = '<shadow id="shadowthree"></shadow>';
+
+is(firstShadow.getElementById("shadowone").olderShadowRoot, null, "Shadow element in oldest ShadowRoot should not be associated with a ShadowRoot.");
+is(secondShadow.getElementById("shadowtwo").olderShadowRoot, firstShadow, "Shadow element should be associated with older ShadowRoot.");
+is(thirdShadow.getElementById("shadowthree").olderShadowRoot, secondShadow, "Shadow element should be associated with older ShadowRoot.");
+
+// Only the first ShadowRoot in tree order is an insertion point.
+host = document.createElement("span");
+firstShadow = host.createShadowRoot();
+secondShadow = host.createShadowRoot();
+secondShadow.innerHTML = '<shadow id="shadowone"></shadow><shadow id="shadowtwo"></shadow>';
+var shadowElemOne = secondShadow.getElementById("shadowone");
+var shadowElemTwo = secondShadow.getElementById("shadowtwo");
+
+is(shadowElemOne.olderShadowRoot, firstShadow, "First <shadow> in tree order should be an insertion point.");
+is(shadowElemTwo.olderShadowRoot, null, "Second <shadow> in tree order should not be an insertion point.");
+
+// Remove the first <shadow> element and make sure the second <shadow> element becomes an insertion point.
+secondShadow.removeChild(shadowElemOne);
+is(shadowElemOne.olderShadowRoot, null, "<shadow> element not in a ShadowRoot is not an insertion point.");
+is(shadowElemTwo.olderShadowRoot, firstShadow, "Second <shadow> element should become insertion point after first is removed.");
+
+// Insert a <shadow> element before the current shadow insertion point and make sure that it becomes an insertion point.
+secondShadow.insertBefore(shadowElemOne, shadowElemTwo);
+is(shadowElemOne.olderShadowRoot, firstShadow, "<shadow> element inserted as first in tree order should become an insertion point.");
+is(shadowElemTwo.olderShadowRoot, null, "<shadow> element should no longer be an insertion point it another is inserted before.");
+
+// <shadow> element in fallback content is not an insertion point.
+host = document.createElement("span");
+firstShadow = host.createShadowRoot();
+secondShadow = host.createShadowRoot();
+secondShadow.innerHTML = '<content><shadow id="shadowone"></shadow></content><shadow id="shadowtwo"></shadow>';
+shadowElemOne = secondShadow.getElementById("shadowone");
+shadowElemTwo = secondShadow.getElementById("shadowtwo");
+
+is(shadowElemOne.olderShadowRoot, null, "<shadow> element in fallback content is not an insertion point.");
+is(shadowElemTwo.olderShadowRoot, null, "<shadow> element preceeded by another <shadow> element is not an insertion point.");
+
+// <shadow> element that is descendant of shadow element is not an insertion point.
+host = document.createElement("span");
+firstShadow = host.createShadowRoot();
+secondShadow = host.createShadowRoot();
+secondShadow.innerHTML = '<shadow><shadow id="shadowone"></shadow></shadow>';
+shadowElemOne = secondShadow.getElementById("shadowone");
+is(shadowElemOne.olderShadowRoot, null, "<shadow> element that is descendant of shadow element is not an insertion point.");
+
+// Check projection of <content> elements through <shadow> elements.
+host = document.createElement("span");
+firstShadow = host.createShadowRoot();
+secondShadow = host.createShadowRoot();
+firstShadow.innerHTML = '<content id="firstcontent"></content>';
+secondShadow.innerHTML = '<shadow><span id="one"></span><content id="secondcontent"></content><span id="four"></span></shadow>';
+host.innerHTML = '<span id="two"></span><span id="three"></span>';
+var firstContent = firstShadow.getElementById("firstcontent");
+var secondContent = secondShadow.getElementById("secondcontent");
+var firstDistNodes = firstContent.getDistributedNodes();
+var secondDistNodes = secondContent.getDistributedNodes();
+
+is(secondDistNodes.length, 2, "There should be two distributed nodes from the host.");
+ok(secondDistNodes[0].id == "two" &&
+ secondDistNodes[1].id == "three", "Nodes projected from host should preserve order.");
+
+is(firstDistNodes.length, 4, "There should be four distributed nodes, two from the first shadow, two from the second shadow.");
+ok(firstDistNodes[0].id == "one" &&
+ firstDistNodes[1].id == "two" &&
+ firstDistNodes[2].id == "three" &&
+ firstDistNodes[3].id == "four", "Reprojection through shadow should preserve node order.");
+
+// Remove a node from the host and make sure that it is removed from all insertion points.
+host.removeChild(host.firstChild);
+firstDistNodes = firstContent.getDistributedNodes();
+secondDistNodes = secondContent.getDistributedNodes();
+
+is(secondDistNodes.length, 1, "There should be one distriubted node remaining after removing node from host.");
+ok(secondDistNodes[0].id == "three", "Span with id=two should have been removed from content element.");
+is(firstDistNodes.length, 3, "There should be three distributed nodes remaining after removing node from host.");
+ok(firstDistNodes[0].id == "one" &&
+ firstDistNodes[1].id == "three" &&
+ firstDistNodes[2].id == "four", "Reprojection through shadow should preserve node order.");
+
+// Check projection of <shadow> elements to <content> elements.
+host = document.createElement("span");
+firstShadow = host.createShadowRoot();
+secondShadow = host.createShadowRoot();
+secondShadow.innerHTML = '<span id="firstspan"><shadow></shadow></span>';
+thirdShadow = secondShadow.getElementById("firstspan").createShadowRoot();
+thirdShadow.innerHTML = '<content id="firstcontent"></content>';
+firstContent = thirdShadow.getElementById("firstcontent");
+var shadowChild = document.createElement("span");
+firstShadow.appendChild(shadowChild);
+
+is(firstContent.getDistributedNodes()[0], shadowChild, "Elements in shadow insertioin point should be projected into content insertion points.");
+
+// Remove child of ShadowRoot and check that projected node is removed from insertion point.
+firstShadow.removeChild(firstShadow.firstChild);
+
+is(firstContent.getDistributedNodes().length, 0, "Reprojected element was removed from ShadowRoot, thus it should be removed from content insertion point.");
+
+// Check deeply nested projection of <shadow> elements.
+host = document.createElement("span");
+firstShadow = host.createShadowRoot();
+firstShadow.innerHTML = '<content></content>';
+secondShadow = host.createShadowRoot();
+secondShadow.innerHTML = '<shadow><content></content></shadow>';
+thirdShadow = host.createShadowRoot();
+thirdShadow.innerHTML = '<span id="firstspan"><shadow><content></content></shadow></span>';
+var fourthShadow = thirdShadow.getElementById("firstspan").createShadowRoot();
+fourthShadow.innerHTML = '<content id="firstcontent"></content>';
+firstContent = fourthShadow.getElementById("firstcontent");
+host.innerHTML = '<span></span>';
+
+is(firstContent.getDistributedNodes()[0], host.firstChild, "Child of host should be projected to insertion point.");
+
+// Remove node and make sure that it is removed from distributed nodes.
+host.removeChild(host.firstChild);
+
+is(firstContent.getDistributedNodes().length, 0, "Node removed from host should be removed from insertion point.");
+
+// Check projection of fallback content through <shadow> elements.
+host = document.createElement("span");
+firstShadow = host.createShadowRoot();
+firstShadow.innerHTML = '<content><span id="firstspan"></span></content>';
+secondShadow = host.createShadowRoot();
+secondShadow.innerHTML = '<span id="secondspan"><shadow id="firstshadow"></shadow></span>';
+firstShadowElem = secondShadow.getElementById("firstshadow");
+thirdShadow = secondShadow.getElementById("secondspan").createShadowRoot();
+thirdShadow.innerHTML = '<content id="firstcontent"></content>';
+firstContent = thirdShadow.getElementById("firstcontent");
+
+is(firstContent.getDistributedNodes().length, 1, "There should be one node distributed from fallback content.");
+is(firstContent.getDistributedNodes()[0], firstShadow.getElementById("firstspan"), "Fallback content should be distributed.");
+
+// Add some content to the host (causing the fallback content to be dropped) and make sure distribution nodes are updated.
+
+var newElem = document.createElement("div");
+firstShadowElem.appendChild(newElem);
+
+is(firstContent.getDistributedNodes().length, 1, "There should be one node distributed from the host.");
+is(firstContent.getDistributedNodes()[0], newElem, "Distributed node should be from host, not fallback content.");
+
+// Remove the distribution node and check that fallback content is used.
+firstShadowElem.removeChild(newElem);
+
+is(firstContent.getDistributedNodes().length, 1, "There should be one node distributed from fallback content.");
+is(firstContent.getDistributedNodes()[0], firstShadow.getElementById("firstspan"), "Fallback content should be distributed after removing node from host.");
+
+</script>
+</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 000000000..9f913d007
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for ShadowRoot</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="movedtoshadow" class="testclass"></div>
+<svg id="svgmovedtoshadow"></svg>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+// Create ShadowRoot.
+var element = document.createElement("div");
+ok(!element.shadowRoot, "div element should not have a shadow root.");
+var shadow = element.createShadowRoot();
+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 = document.getElementById("movedtoshadow");
+var inShadowSVGEl = document.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(!document.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(!document.getElementById("svgmovedtoshadow"), "SVG element appended to a ShadowRoot should not be accessible from document.");
+
+// Test getElementsByClassName
+is(document.getElementsByClassName("testclass").length, 0, "Element removed from DOM should not be accessible by DOM accessors.");
+is(shadow.getElementsByClassName("testclass").length, 1, "Element added to ShadowRoot should be accessible by ShadowRoot API.");
+
+// Test getElementsByTagName{NS}
+is(document.getElementsByTagName("div").length, 0, "Element removed from DOM should not be accessible from DOM accessors.");
+is(shadow.getElementsByTagName("div").length, 1, "Elements in the ShadowRoot should be accessible from the ShadowRoot API.");
+is(document.getElementsByTagName("svg").length, 0, "SVG elements removed from DOM should not be accessible from DOM accessors.");
+is(shadow.getElementsByTagName("svg").length, 1, "SVG element in the ShadowRoot should be accessible from the ShadowRoot API.");
+is(shadow.getElementsByTagNameNS("http://www.w3.org/2000/svg", "svg").length, 1, "SVG element in the ShadowRoot should be accessible from the ShadowRoot API.");
+
+// 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.");
+is(shadow.getElementsByClassName("testclass").length, 0, "ShadowRoot getElementsByClassName should not be able to access elements removed from ShadowRoot.");
+is(shadow.getElementsByTagName("svg").length, 0, "ShadowRoot getElementsByTagName should not be able to access elements removed from ShadowRoot.");
+is(shadow.getElementsByTagNameNS("http://www.w3.org/2000/svg", "svg").length, 0, "ShadowRoot getElementsByTagNameNS should not be able to access elements removed from ShadowRoot.");
+
+// Test querySelector on element in a ShadowRoot.
+element = document.createElement("div");
+shadow = element.createShadowRoot();
+var parentDiv = document.createElement("div");
+var childSpan = document.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 = document.createElement("div");
+shadow = element.createShadowRoot();
+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.");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_host.html b/dom/tests/mochitest/webcomponents/test_shadowroot_host.html
new file mode 100644
index 000000000..f48d63e87
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_host.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1083587
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1083587</title>
+ <script type="application/javascript" 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=1083587">Mozilla Bug 1083587</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<div id="host"></div>
+</div>
+<pre id="test">
+</pre>
+<script type="application/javascript">
+
+/** Test for Bug 1083587 **/
+var hostInDoc = document.getElementById("host");
+var shadowOne = hostInDoc.createShadowRoot();
+is(shadowOne.host, hostInDoc);
+
+var shadowTwo = hostInDoc.createShadowRoot();
+is(shadowOne.host, hostInDoc);
+is(shadowTwo.host, hostInDoc);
+
+var hostNotInDoc = document.createElement("div");
+var shadowThree = hostNotInDoc.createShadowRoot();
+is(shadowThree.host, hostNotInDoc);
+
+var shadowFour = hostNotInDoc.createShadowRoot();
+is(shadowThree.host, hostNotInDoc);
+is(shadowFour.host, hostNotInDoc);
+
+</script>
+</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 000000000..ca525adad
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_inert_element.html
@@ -0,0 +1,44 @@
+<!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="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="runChecks();">
+<div id="grabme"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+
+var element = document.getElementById("grabme");
+var shadow = element.createShadowRoot();
+
+// Check that <base> is inert.
+shadow.innerHTML = '<base href="http://www.example.org/" />';
+isnot(document.baseURI, "http://www.example.org/", "Base element should be inert in ShadowRoot.");
+
+SimpleTest.waitForExplicitFinish();
+
+// Check that <link> is inert.
+var numStyleBeforeLoad = document.styleSheets.length;
+
+shadow.innerHTML = '<link id="shadowlink" rel="stylesheet" type="text/css" href="inert_style.css" /><span id="shadowspan"></span>';
+shadow.applyAuthorStyles = true;
+var shadowSpan = shadow.getElementById("shadowspan");
+var shadowStyle = shadow.getElementById("shadowlink");
+
+function runChecks() {
+ isnot(getComputedStyle(shadowSpan, null).getPropertyValue("padding-top"), "10px", "Link element should be inert.");
+ is(document.styleSheets.length, numStyleBeforeLoad, "Document style count should remain the same because the style should not be in the doucment.");
+ is(shadow.styleSheets.length, 0, "Inert link should not add style to ShadowRoot.");
+ // Remove link to make sure we don't get assertions.
+ shadow.removeChild(shadowStyle);
+ 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 000000000..f310ff97c
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_style.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for ShadowRoot styling</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div class="tall" id="bodydiv"></div>
+<div id="container"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+// Create ShadowRoot.
+var container = document.getElementById("container");
+var elem = document.createElement("div");
+container.appendChild(elem); // Put ShadowRoot host in document.
+var root = elem.createShadowRoot();
+
+// A style element that will be appended into the ShadowRoot.
+var shadowStyle = document.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(document.styleSheets.length, 1, "There should only be one style sheet on the document from the test style sheet.");
+is(root.styleSheets.length, 0, "The ShadowRoot should have no style sheets.");
+root.appendChild(shadowStyle);
+is(document.styleSheets.length, 1, "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 = document.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(getComputedStyle(document.getElementById("bodydiv"), null).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(getComputedStyle(divToStyle, null).getPropertyValue("height"), "100px", "ShadowRoot style sheets should apply to elements in ShadowRoot.");
+
+// Tests for applyAuthorStyles.
+var authorStyle = document.createElement("style");
+authorStyle.innerHTML = ".fat { padding-right: 20px; padding-left: 30px; }";
+document.body.appendChild(authorStyle);
+
+is(root.applyAuthorStyles, false, "applyAuthorStyles defaults to false.");
+isnot(getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should not apply to ShadowRoot when ShadowRoot.applyAuthorStyles is false.");
+root.applyAuthorStyles = true;
+is(root.applyAuthorStyles, true, "applyAuthorStyles was set to true.");
+is(getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should apply to ShadowRoot when ShadowRoot.applyAuthorStyles is true.");
+root.applyAuthorStyles = false;
+is(root.applyAuthorStyles, false, "applyAuthorStyles was set to false.");
+isnot(getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should not apply to ShadowRoot when ShadowRoot.applyAuthorStyles is false.");
+
+// Test dynamic changes to style in ShadowRoot.
+root.innerHTML = '<div id="divtostyle" class="dummy"></div>';
+divToStyle = root.getElementById("divtostyle");
+var dummyShadowStyle = document.createElement("style");
+dummyShadowStyle.innerHTML = ".dummy { height: 300px; }";
+root.appendChild(dummyShadowStyle);
+is(getComputedStyle(divToStyle, null).getPropertyValue("height"), "300px", "Dummy element in ShadowRoot should be styled by style in ShadowRoot.");
+dummyShadowStyle.innerHTML = ".dummy { height: 200px; }";
+is(getComputedStyle(divToStyle, null).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(getComputedStyle(divToStyle, null).getPropertyValue("padding-top"), "10px", "ID selector in style selector should match element.");
+
+</script>
+</body>
+</html>
+
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html b/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html
new file mode 100644
index 000000000..7a606bcd7
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=806506
+-->
+<head>
+ <title>Test for ShadowRoot styles with multiple ShadowRoot on host.</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div class="tall" id="bodydiv"></div>
+<div id="container"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+// Create ShadowRoot.
+var container = document.getElementById("container");
+var elem = document.createElement("div");
+container.appendChild(elem); // Put ShadowRoot host in document.
+var firstRoot = elem.createShadowRoot();
+var secondRoot = elem.createShadowRoot();
+var thirdRoot = elem.createShadowRoot();
+
+// A style element that will be appended into the ShadowRoot.
+var firstStyle = document.createElement("style");
+firstRoot.appendChild(firstStyle);
+is(firstRoot.styleSheets.length, 1, "firstStyle should be the only style in firstRoot.");
+is(firstRoot.styleSheets[0].ownerNode, firstStyle, "firstStyle should in the ShadowRoot styleSheets.");
+
+var secondStyle = document.createElement("style");
+secondRoot.appendChild(secondStyle);
+is(secondRoot.styleSheets.length, 1, "secondStyle should be the only style in secondRoot.");
+is(secondRoot.styleSheets[0].ownerNode, secondStyle, "secondStyle should in the ShadowRoot styleSheets.");
+
+var thirdStyle = document.createElement("style");
+thirdRoot.appendChild(thirdStyle);
+is(thirdRoot.styleSheets.length, 1, "thirdStyle should be the only style in thirdRoot.");
+is(thirdRoot.styleSheets[0].ownerNode, thirdStyle, "thirdStyle should in the ShadowRoot styleSheets.");
+
+// Check the stylesheet counts again to make sure that none of the style sheets leaked into the older ShadowRoots.
+is(firstRoot.styleSheets.length, 1, "Adding a stylesheet to a younger ShadowRoot should not affect stylesheets in the older ShadowRoot.");
+is(secondRoot.styleSheets.length, 1, "Adding a stylesheet to a younger ShadowRoot should not affect stylesheets in the older ShadowRoot.");
+
+// Remove styles and make sure they are removed from the correct ShadowRoot.
+firstRoot.removeChild(firstStyle);
+is(firstRoot.styleSheets.length, 0, "firstRoot should no longer have any styles.");
+
+thirdRoot.removeChild(thirdStyle);
+is(thirdRoot.styleSheets.length, 0, "thirdRoot should no longer have any styles.");
+
+secondRoot.removeChild(secondStyle);
+is(secondRoot.styleSheets.length, 0, "secondRoot should no longer have any styles.");
+
+</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 000000000..524b9bcca
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_style_order.html
@@ -0,0 +1,42 @@
+<!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="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="container"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+// Create ShadowRoot.
+var container = document.getElementById("container");
+var elem = document.createElement("div");
+container.appendChild(elem); // Put ShadowRoot host in document.
+var root = elem.createShadowRoot();
+
+// Style elements that will be appended into the ShadowRoot.
+var tallShadowStyle = document.createElement("style");
+tallShadowStyle.innerHTML = ".tall { height: 100px; }";
+
+var veryTallShadowStyle = document.createElement("style");
+veryTallShadowStyle.innerHTML = ".tall { height: 200px; }";
+
+var divToStyle = document.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(window.getComputedStyle(divToStyle, null).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(window.getComputedStyle(divToStyle, null).getPropertyValue("height"), "200px", "Style in ShadowRoot should apply to elements in ShadowRoot in tree order.");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html b/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html
new file mode 100644
index 000000000..17743321b
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1083587
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1083587</title>
+ <script type="application/javascript" 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=1083587">Mozilla Bug 1083587</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<div id="host"></div>
+</div>
+<pre id="test">
+</pre>
+<script type="application/javascript">
+
+/** Test for Bug 1083587 **/
+var hostInDoc = document.getElementById("host");
+var shadowOne = hostInDoc.createShadowRoot();
+is(shadowOne.olderShadowRoot, null);
+
+var shadowTwo = hostInDoc.createShadowRoot();
+is(shadowOne.olderShadowRoot, null);
+is(shadowTwo.olderShadowRoot, shadowOne);
+
+var hostNotInDoc = document.createElement("div");
+var shadowThree = hostNotInDoc.createShadowRoot();
+is(shadowThree.olderShadowRoot, null);
+
+var shadowFour = hostNotInDoc.createShadowRoot();
+is(shadowThree.olderShadowRoot, null);
+is(shadowFour.olderShadowRoot, shadowThree);
+
+</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 000000000..e8d6e6c72
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_style_fallback_content.html
@@ -0,0 +1,28 @@
+<!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="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="grabme"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
+<script>
+var host = document.getElementById("grabme");
+var shadow = host.createShadowRoot();
+shadow.innerHTML = '<style id="innerstyle"></style><span id="container"><content><span id="innerspan">Hello</span></content></span>';
+var innerStyle = shadow.getElementById("innerstyle");
+
+innerStyle.innerHTML = '#innerspan { margin-top: 10px; }';
+var innerSpan = shadow.getElementById("innerspan");
+is(getComputedStyle(innerSpan, null).getPropertyValue("margin-top"), "10px", "Default content should be style by id selector.");
+
+innerStyle.innerHTML = '#container > content > #innerspan { margin-top: 30px; }';
+is(getComputedStyle(innerSpan, null).getPropertyValue("margin-top"), "30px", "Default content should be style by child combinators.");
+</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 000000000..a43e3fba5
--- /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 type="text/javascript" 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_custom_elements.html b/dom/tests/mochitest/webcomponents/test_template_custom_elements.html
new file mode 100644
index 000000000..f7f4340cf
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_template_custom_elements.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1091425
+-->
+<head>
+ <title>Test for custom elements in template</title>
+ <script type="text/javascript" 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>
+
+var p = {};
+p.createdCallback = function() {
+ ok(false, "Created callback should not be called for custom elements in templates.");
+};
+
+document.registerElement("x-foo", { prototype: p });
+
+ok(true, "Created 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_template_xhtml.html b/dom/tests/mochitest/webcomponents/test_template_xhtml.html
new file mode 100644
index 000000000..233ed5b76
--- /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 type="text/javascript" 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_unresolved_pseudo_class.html b/dom/tests/mochitest/webcomponents/test_unresolved_pseudo_class.html
new file mode 100644
index 000000000..3e1fae8ee
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_unresolved_pseudo_class.html
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1111633
+-->
+<head>
+ <title>Test template element in stale document.</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <style>
+ :unresolved {
+ color: rgb(0, 0, 255);
+ background-color: rgb(0, 0, 255);
+ }
+
+ x-foo { color: rgb(255, 0, 0); }
+
+ [is="x-del"]:not(:unresolved) { color: rgb(255, 0, 0); }
+
+ [is="x-bar"]:not(:unresolved) { color: rgb(255, 0, 0); }
+
+ [is="x-bar"]:unresolved { background-color: rgb(255, 0, 0); }
+
+ x-baz:not(:unresolved) {
+ color: rgb(255, 0, 0);
+ background-color: rgb(255, 0, 0);
+ }
+
+ span { color: rgb(0,255,0); }
+
+ x-foo:unresolved + span { color: rgb(255,0,0); }
+
+ </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1111633">Bug 1111633</a>
+<div id="container"></div>
+<x-foo id="foo"></x-foo>
+<span id="span1">This text should be green</span>
+<span id="bar" is="x-bar"></span>
+<x-baz id="baz"></x-baz>
+<span id="del" is="x-del"></span>
+<script>
+
+// Before registerElement
+var foo = document.querySelector('#foo');
+is(getComputedStyle(foo).color, "rgb(0, 0, 255)", "foo - color");
+is(getComputedStyle(foo).backgroundColor, "rgb(0, 0, 255)", "foo - backgroundColor");
+
+var bar = document.querySelector('#bar');
+is(getComputedStyle(bar).color, "rgb(0, 0, 255)", "bar - color");
+is(getComputedStyle(bar).backgroundColor, "rgb(255, 0, 0)", "bar - backgroundColor");
+
+var baz = document.querySelector('#baz');
+is(getComputedStyle(baz).color, "rgb(0, 0, 255)", "baz - color");
+is(getComputedStyle(baz).backgroundColor, "rgb(0, 0, 255)", "baz - backgroundColor");
+
+var span1 = document.querySelector('#span1');
+is(getComputedStyle(span1).color, "rgb(255, 0, 0)", "span1 - color");
+
+var Foo = document.registerElement('x-foo', { prototype: Object.create(HTMLElement.prototype) });
+
+var Bar = document.registerElement('x-bar', { extends: 'span', prototype: Object.create(HTMLSpanElement.prototype) });
+
+var Baz = document.registerElement('x-baz', { prototype: Object.create(HTMLElement.prototype) });
+
+// After registerElement
+is(getComputedStyle(foo).color, "rgb(255, 0, 0)",
+ "foo - color (after registerElement)");
+
+is(getComputedStyle(bar).color,
+ "rgb(255, 0, 0)", "bar - color (after registerElement)");
+
+is(getComputedStyle(baz).color,
+ "rgb(255, 0, 0)", "baz - color (after registerElement)");
+is(getComputedStyle(baz).backgroundColor,
+ "rgb(255, 0, 0)", "baz - backgroundColor (after registerElement)");
+
+is(getComputedStyle(span1).color, "rgb(0, 255, 0)", "span1 - color (after registerElement)");
+
+// After tree removal
+var del = document.querySelector('#del');
+is(getComputedStyle(del).color, "rgb(0, 0, 255)", "del - color");
+var par = del.parentNode;
+par.removeChild(del);
+// Changing is attribute after creation should not change the type
+// of a custom element, even if the element was removed and re-append to the tree.
+del.setAttribute("is", "foobar");
+par.appendChild(del);
+is(getComputedStyle(del).color, "rgb(0, 0, 255)", "del - color (after reappend)");
+var Del = document.registerElement('x-del', { extends: 'span', prototype: Object.create(HTMLSpanElement.prototype) });
+// [is="x-del"] will not match any longer so the rule of span will apply
+is(getComputedStyle(del).color, "rgb(0, 255, 0)", "del - color (after registerElement)");
+// but the element should have been upgraded:
+ok(del instanceof Del, "element was upgraded correctly after changing |is|");
+
+</script>
+</body>
+</html>
diff --git a/dom/tests/mochitest/whatwg/browserFu.js b/dom/tests/mochitest/whatwg/browserFu.js
new file mode 100644
index 000000000..3fb5bdf95
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/browserFu.js
@@ -0,0 +1,6 @@
+/**
+ * File which includes stuff for Mozilla-specific checks which shouldn't happen
+ * in other browsers but which we wish to test.
+ */
+
+var isMozilla = navigator.product === "Gecko" && "buildID" in navigator;
diff --git a/dom/tests/mochitest/whatwg/chrome.ini b/dom/tests/mochitest/whatwg/chrome.ini
new file mode 100644
index 000000000..6d6bfc36c
--- /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 000000000..941cb47c5
--- /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 000000000..3ce66493d
--- /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 000000000..ab853b86c
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/mochitest.ini
@@ -0,0 +1,44 @@
+[DEFAULT]
+support-files =
+ browserFu.js
+ postMessage_chrome_helper.html
+ postMessage_closed_helper.html
+ postMessage_hash.html
+ postMessage_helper.html
+ postMessage_idn_helper.html
+ postMessage.jar
+ postMessage.jar^headers^
+ 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]
+[test_MessageEvent.html]
+[test_postMessage_basehref.html]
+[test_postMessage_closed.html]
+skip-if = toolkit == 'android' #bug 894914 - wrong data - got FAIL, expected message
+[test_postMessage_hash.html]
+[test_postMessage.html]
+[test_postMessage_idn.xhtml]
+[test_postMessage_jar.html]
+[test_postMessage_joined.html]
+[test_postMessage_onOther.html]
+[test_postMessage_origin.xhtml]
+[test_postMessage_override.html]
+[test_postMessage_special.xhtml]
+[test_postMessage_structured_clone.html]
+[test_postMessage_throw.html]
+[test_postMessage_transfer.html]
+[test_postMessage_userpass.html]
+[test_bug500328.html]
+skip-if = true || toolkit=='android' # bug 696306, #TIMED_OUT android
+support-files = file_bug500328_1.html file_bug500328_2.html
diff --git a/dom/tests/mochitest/whatwg/postMessage.jar b/dom/tests/mochitest/whatwg/postMessage.jar
new file mode 100644
index 000000000..d4ee4abc3
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage.jar
Binary files differ
diff --git a/dom/tests/mochitest/whatwg/postMessage.jar^headers^ b/dom/tests/mochitest/whatwg/postMessage.jar^headers^
new file mode 100644
index 000000000..28b8aa0a5
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage.jar^headers^
@@ -0,0 +1 @@
+Content-Type: application/java-archive
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 000000000..86a57ed0f
--- /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, false);
+ </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 000000000..240ae57b8
--- /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, false);
+
+function setup()
+{
+ var query = location.search.substring(1);
+
+ if (query == "opener")
+ window.opener.postMessage("message", "http://mochi.test:8888");
+}
+
+window.addEventListener("load", setup, false);
+ </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 000000000..adb82aa5f
--- /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, false);
+ </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 000000000..86e34e9d4
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_helper.html
@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage message receiver</title>
+ <script type="application/javascript" src="browserFu.js"></script>
+ <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 (isMozilla)
+ {
+ if (evt.isTrusted !== false)
+ response += " unexpected-trusted";
+ }
+
+ 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, false);
+ window.addEventListener("message", receiveMessage, false);
+ </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 000000000..c66932280
--- /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, false);
+
+ function setup()
+ {
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+ }
+
+ window.addEventListener("load", setup, false);
+ </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 000000000..83988d103
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_joined_helper.html
@@ -0,0 +1,91 @@
+<!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" src="browserFu.js"></script>
+ <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 + ")";
+ }
+
+ if (isMozilla && evt.isTrusted === true)
+ {
+ response += " unexpected-trusted-event";
+ }
+
+ 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, false);
+ }
+
+ window.addEventListener("load", setup, false);
+ </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 000000000..7535b05d3
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html
@@ -0,0 +1,78 @@
+<!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" src="browserFu.js"></script>
+ <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 (isMozilla)
+ {
+ if (evt.isTrusted !== false)
+ response += " unexpected-trusted-event";
+ }
+
+ 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, false);
+ }
+
+ window.addEventListener("load", setup, false);
+ </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 000000000..dd4cf370a
--- /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, false);
+ window.addEventListener("load", setup, false);
+ </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 000000000..9dd00c1ee
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml
@@ -0,0 +1,37 @@
+<!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)
+{
+ 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, false);
+
+
+// Aids for identifying origins
+
+function setup()
+{
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+}
+
+window.addEventListener("load", setup, false);
+ ]]></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 000000000..ffe5d628a
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_override_helper.html
@@ -0,0 +1,42 @@
+<!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 == 1)
+ {
+ 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, false);
+
+ window.addEventListener("load", setup, false);
+ </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 000000000..b3cdfac2f
--- /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;version=1.7"
+ src="postMessage_structured_clone_helper.js"></script>
+ <script type="application/javascript;version=1.7">
+ var generator = new 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 > 0) {
+ 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()))
+ window.parent.postMessage("TEST-PASS", "*");
+ else
+ window.parent.postMessage("TEST-FAIL", "*");
+ }
+ window.addEventListener("message", receiveMessage, false);
+ </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 000000000..d56bc3298
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.js
@@ -0,0 +1,63 @@
+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 000000000..b3d22c657
--- /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, false);
+
+ function setup()
+ {
+ var target = document.getElementById("location");
+ target.textContent = location.hostname + ":" + (location.port || 80);
+ }
+
+ window.addEventListener("load", setup, false);
+ </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 000000000..03c4c1030
--- /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 000000000..fab25b59d
--- /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, false);
+ </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 000000000..ce30cd406
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_MessageEvent.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>MessageEvent tests</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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: bubbles, cancelable: cancelable, data: data,
+ origin: origin, lastEventId: 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, false);
+ document.addEventListener("message", recvMsg, false);
+ 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 000000000..0b742e4f1
--- /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 type="text/javascript" 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 000000000..030c8f43b
--- /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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" 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 000000000..6b6e2ea98
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_bug500328.html
@@ -0,0 +1,771 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=500328
+-->
+<head>
+ <title>Test for Bug 500328</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=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;version=1.7">
+
+/** 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.wrap(document).defaultView.
+ QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
+ getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
+ return utils.getVisitedDependentComputedStyle(elem, "", "color");
+}
+
+function getSHistory(theWindow)
+{
+ const Ci = SpecialPowers.Ci;
+ var sh = SpecialPowers.wrap(theWindow.QueryInterface(Ci.nsIInterfaceRequestor))
+ .getInterface(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.getEntryAtIndex(sh.index + offset, false).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();
+}, false);
+
+</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 000000000..7e0e938c5
--- /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 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=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 000000000..ca6389790
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage.html
@@ -0,0 +1,166 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>Basic postMessage tests</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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'");
+
+ if (isMozilla)
+ {
+ ok(evt.isTrusted === false, "shouldn't 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, false);
+window.addEventListener("message", messageReceiver, false);
+
+</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 000000000..f2d40e843
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_basehref.html
@@ -0,0 +1,46 @@
+<!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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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, false);
+
+function run()
+{
+ window.postMessage("generate-event", "http://mochi.test:8888");
+}
+
+window.addEventListener("load", run, false);
+</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 000000000..e50ef6f09
--- /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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" 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, false);
+ window.postMessage("post-to-self", "*");
+}
+
+window.addEventListener("load", run, false);
+</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 000000000..5a6f3f928
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_closed.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage's interaction with closed windows</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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, false);
+ evt.source.postMessage("NOT-RECEIVED", "*");
+
+ var iframe = document.createElement("iframe");
+ iframe.id = "insertedIframe";
+ $("holder").appendChild(iframe);
+ iframe.addEventListener("load", iframeLoaded, false);
+ iframe.src = "postMessage_closed_helper.html?parent";
+ }
+
+ setTimeout(afterClose, 0);
+}
+
+window.addEventListener("message", receiveMessage, false);
+
+function iframeLoaded(evt)
+{
+ var iframe = $("insertedIframe");
+ iframe.removeEventListener("load", iframeLoaded, false);
+
+ 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, false);
+</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 000000000..30996ef49
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_hash.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>postMessage's interaction with hash URIs</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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, false);
+
+function run()
+{
+ window.frames.kid.postMessage("from-parent", "http://mochi.test:8888");
+}
+
+window.addEventListener("load", run, false);
+</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 000000000..7c1178f26
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml
@@ -0,0 +1,71 @@
+<?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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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'");
+
+ if (isMozilla)
+ {
+ ok(evt.isTrusted === false, "shouldn't have been a trusted event");
+ }
+
+ is(evt.origin, "http://sub1.ält.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, false);
+
+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_jar.html b/dom/tests/mochitest/whatwg/test_postMessage_jar.html
new file mode 100644
index 000000000..3bc453921
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_jar.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=430251
+-->
+<head>
+ <title>postMessage's interaction with pages at jar: URIs</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <base href="http://mochi.test:8888/" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430251">Mozilla Bug 430251</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 430251 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveMessage(evt)
+{
+ is(evt.origin, "http://mochi.test:8888", "wrong sender");
+ ok(evt.source === window.frames.kid, "wrong source");
+
+ is(evt.data, "finish-test", "wrong data");
+ is(evt.lastEventId, "", "wrong lastEventId");
+
+ SimpleTest.finish();
+}
+
+window.addEventListener("message", receiveMessage, false);
+
+addLoadEvent(function() {
+ SpecialPowers.pushPrefEnv({"set": [["network.jar.block-remote-files", false]]}, function() {
+ var iframe = document.createElement('iframe');
+ iframe.setAttribute('src', 'jar:http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage.jar!/postMessage_jar.html');
+ iframe.setAttribute('name', 'kid');
+ document.getElementById("content").appendChild(iframe);
+
+ iframe.onload = function() {
+ window.frames.kid.postMessage("start-test", "http://mochi.test:8888");
+ }
+ });
+});
+</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 000000000..034151a12
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_joined.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage with document.domain setting to join origins</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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'");
+
+ if (isMozilla)
+ {
+ ok(evt.isTrusted === false, "shouldn't 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, false);
+ 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 000000000..4cb4f98da
--- /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 type="text/javascript" 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, false);
+window.addEventListener("load", run, false);
+</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 000000000..f6a919896
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml
@@ -0,0 +1,545 @@
+<!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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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);
+}
+
+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.παράδειγμα.δοκιμή"
+ },
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή:80"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή:80/"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή:80/foobar"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ // 40
+ {
+ args: ["PASS", "http://sub1.παράδειγμα.δοκιμή/foobar"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp:80"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp:80/"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ {
+ args: ["PASS", "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp:80/foo"],
+ source: "idnKidWhitelist",
+ returnOrigin: "http://sub1.παράδειγμα.δοκιμή"
+ },
+ // 45
+ {
+ args: ["PASS", "http://sub1.exaмple.test"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test:80"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test:80/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.exaмple.test/foobar"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ // 50
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test:80"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test:80/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test/"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ {
+ args: ["PASS", "http://sub1.xn--exaple-kqf.test/foobar"],
+ source: "idnKidNoWhitelist",
+ returnOrigin: "http://sub1.exaмple.test",
+
+ hasWrongReturnOriginBug: true
+ },
+ // 55
+ {
+ args: ["NOT-RECEIVED", undefined],
+ source: "sameDomain",
+ name: "SyntaxError",
+ code: DOMException.SYNTAX_ERR
+ },
+ ];
+
+function allTests(callback)
+{
+ var test, target, called;
+
+ function eventCheck(evt)
+ {
+ ok(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;
+ }
+
+ function nextTest()
+ {
+ i++;
+
+ if (i === end)
+ {
+ removeListener(listener);
+
+ setTimeout(callback, 0);
+ return;
+ }
+
+ test = tests[i];
+
+ target = $(test.source).contentWindow;
+ try
+ {
+ called = false;
+ 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
+ // call nextTest directly.
+ errorCheck(i, called, e.name, test.name);
+ errorCheck(i, called, e.code, test.code);
+ nextTest();
+ return;
+ }
+
+ // We've set up the event generated by postMessage to be dispatched, and
+ // it's sitting in a queue somewhere. However, it hasn't arrived yet, and
+ // the target document hasn't received the event -- so we need to continue
+ // our tests later.
+ setTimeout(function()
+ {
+ // The event was dispatched, and the target frame's code processed it and
+ // responded -- so now *that* response is sitting in the queue of script to
+ // execute. Process pending script one more time so we know we've gotten
+ // the response.
+ setTimeout(function()
+ {
+ // Finally, we've posted our message and received our response, and
+ // there's nothing further coming down the pipe.
+ if (test.hasThrowsNoExceptionBug)
+ todo(false, "should throw on test #" + i);
+ else
+ ok(test.expectNoCallback ^ called, "should have been called #" + i);
+
+ nextTest();
+ }, 0);
+ }, 0);
+ }
+
+ var listener = registerMessageListener(eventCheck);
+
+ var i = -1, end = tests.length;
+ nextTest();
+}
+
+function registerMessageListener(func, callback)
+{
+ function receive(evt)
+ {
+ func(evt);
+ if (callback)
+ callback();
+ }
+
+ window.addEventListener("message", receive, false);
+
+ return receive;
+}
+
+function removeListener(listener)
+{
+ window.removeEventListener("message", listener, false);
+}
+
+function oddballTests(callback)
+{
+ var called = false;
+
+ function eventChecks(evt)
+ {
+ 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");
+ called = true;
+ }
+
+ var listener = registerMessageListener(eventChecks, function()
+ {
+ is(called, true, "should have been called");
+ removeListener(listener);
+
+ called = false;
+ listener = registerMessageListener(eventChecks, function()
+ {
+ is(called, true, "should have been called");
+
+ removeListener(listener);
+ callback();
+ });
+
+ window.postMessage("PASS", "http://mochi.test:8888");
+ });
+
+ window.postMessage("PASS", "http://mochi.test:8888");
+}
+
+function run()
+{
+ oddballTests(function()
+ {
+ allTests(function()
+ {
+ SimpleTest.finish();
+ });
+ });
+}
+
+window.addEventListener("load", run, false);
+]]></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 000000000..a776ccebe
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_override.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
+-->
+<head>
+ <title>postMessage override test</title>
+ <script type="text/javascript" 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();
+
+var count = 0;
+
+function test(callback)
+{
+ try
+ {
+ count++;
+ switch (count)
+ {
+ case 1:
+ window.frames[0].postMessage("PASS 1", "http://example.org:8000");
+ break;
+
+ case 2:
+ window.frames[0].postMessage("PASS 2", "http://example.org:8000");
+ break;
+
+ default:
+ ok(false, "unexpected");
+ }
+ }
+ catch (e)
+ {
+ ok(false, "error running test " + count + ": " + e);
+ }
+
+ // Waiting for sent postMessage event to be processed...
+ setTimeout(function()
+ {
+ // Waiting for responding postMessage event to be processed...
+ setTimeout(function()
+ {
+ // We have our response!
+ callback();
+ }, 0);
+ }, 0);
+}
+
+function messageReceiver(evt)
+{
+ var expect;
+
+ switch (count)
+ {
+ case 1:
+ expect = "PASS 1";
+ break;
+
+ case 2:
+ expect = "PASS 2";
+ break;
+
+ default:
+ expect = "unexpected";
+ break;
+ }
+
+ is(evt.data, expect,
+ "uh-oh, we (" + count + ") didn't get the right postMessage!");
+}
+
+window.addEventListener("message", messageReceiver, false);
+
+function run()
+{
+ test(function()
+ {
+ test(function()
+ {
+ SimpleTest.finish();
+ }, 0);
+ });
+}
+
+window.addEventListener("load", run, false);
+</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 000000000..bf443af99
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml
@@ -0,0 +1,311 @@
+<!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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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'");
+
+ if (isMozilla)
+ {
+ ok(evt.isTrusted === false, "shouldn't 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")
+ {
+ // HTML5 defines the origin of a data: URI as the origin of the window or
+ // script that opened the data: URI.
+ is(evt.origin, "http://mochi.test:8888",
+ "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, false);
+ 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", "http://mochi.test:8888");
+}
+
+window.addEventListener("message", messageReceiver, false);
+
+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 000000000..ec0941227
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=553125
+-->
+<head>
+ <title>postMessage uses structured clone</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript;version=1.7"
+ 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 = new getTestContent();
+
+function runNextSameOrigin() {
+ try {
+ lastMessage = generator.next();
+ } catch (e) {
+ generator = new getTestContent();
+ crossOrigin = true;
+ runNextCrossOrigin();
+ }
+ window.frames.sameDomain.postMessage(lastMessage, "http://mochi.test:8888");
+}
+
+function runNextCrossOrigin() {
+ try {
+ lastMessage = generator.next();
+ } catch (e) {
+ SimpleTest.finish();
+ }
+ 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, false);
+window.addEventListener("load", runNextSameOrigin, false);
+
+</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 000000000..90391e78f
--- /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 type="text/javascript" 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 000000000..996a04f51
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_transfer.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=822094
+-->
+<head><meta charset=utf-8>
+ <title>postMessage transferable tests</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="browserFu.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 000000000..d0cd7d5d5
--- /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 type="text/javascript" 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, false);
+
+function sendMessage(evt)
+{
+ window.frames.userPassKid.postMessage("parent-message", "http://example.org");
+}
+
+window.addEventListener("load", sendMessage, false);
+</script>
+</pre>
+</body>
+</html>