Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=346485 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 346485</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=346485">Mozilla Bug 346485</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | <input id='a'> |
michael@0 | 16 | <input id='b'> |
michael@0 | 17 | <output id='o' for='a b'></output> |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script type="application/javascript"> |
michael@0 | 21 | |
michael@0 | 22 | /** Test for Bug 346485 **/ |
michael@0 | 23 | |
michael@0 | 24 | /** |
michael@0 | 25 | * This test is testing DOMSettableTokenList used by the output element. |
michael@0 | 26 | */ |
michael@0 | 27 | |
michael@0 | 28 | var o = document.getElementById('o'); |
michael@0 | 29 | |
michael@0 | 30 | is(o.htmlFor, 'a b', |
michael@0 | 31 | "htmlFor IDL attribute should reflect for content attribute"); |
michael@0 | 32 | |
michael@0 | 33 | is(o.htmlFor.value, 'a b', |
michael@0 | 34 | "value should return the underlying string"); |
michael@0 | 35 | |
michael@0 | 36 | is(o.htmlFor.length, 2, "Size should be '2'"); |
michael@0 | 37 | |
michael@0 | 38 | ok(o.htmlFor.contains('a'), "It should contain 'a' token'"); |
michael@0 | 39 | ok(!o.htmlFor.contains('c'), "It should not contain 'c' token"); |
michael@0 | 40 | |
michael@0 | 41 | is(o.htmlFor.item(0), 'a', "First item is 'a' token'"); |
michael@0 | 42 | is(o.htmlFor.item(42), null, "Out-of-range should return null"); |
michael@0 | 43 | |
michael@0 | 44 | o.htmlFor.add('c'); |
michael@0 | 45 | is(o.htmlFor, 'a b c', "'c' token should have been added"); |
michael@0 | 46 | is(o.htmlFor.length, 3, "Size should be '3'"); |
michael@0 | 47 | |
michael@0 | 48 | o.htmlFor.add('a'); |
michael@0 | 49 | is(o.htmlFor, 'a b c', "Nothing should have changed"); |
michael@0 | 50 | is(o.htmlFor.length, 3, "Size should be '3'"); |
michael@0 | 51 | |
michael@0 | 52 | o.htmlFor.remove('a'); |
michael@0 | 53 | is(o.htmlFor, 'b c', "'a' token should have been removed"); |
michael@0 | 54 | is(o.htmlFor.length, 2, "Size should be '2'"); |
michael@0 | 55 | |
michael@0 | 56 | o.htmlFor.remove('d'); |
michael@0 | 57 | is(o.htmlFor, 'b c', "Nothing should have been removed"); |
michael@0 | 58 | is(o.htmlFor.length, 2, "Size should be '2'"); |
michael@0 | 59 | |
michael@0 | 60 | o.htmlFor.toggle('a'); |
michael@0 | 61 | is(o.htmlFor, 'b c a', "'a' token should have been added"); |
michael@0 | 62 | is(o.htmlFor.length, 3, "Size should be '3'"); |
michael@0 | 63 | |
michael@0 | 64 | o.htmlFor.toggle('b'); |
michael@0 | 65 | is(o.htmlFor, 'c a', "Nothing should have changed"); |
michael@0 | 66 | is(o.htmlFor.length, 2, "Size should be '2'"); |
michael@0 | 67 | |
michael@0 | 68 | o.htmlFor.value = "foo bar"; |
michael@0 | 69 | is(o.htmlFor, 'foo bar', "The underlying string should have changed"); |
michael@0 | 70 | is(o.htmlFor.length, 2, "Size should be '2'"); |
michael@0 | 71 | ok(o.htmlFor.contains('foo'), "It should contain 'foo'"); |
michael@0 | 72 | |
michael@0 | 73 | </script> |
michael@0 | 74 | </pre> |
michael@0 | 75 | </body> |
michael@0 | 76 | </html> |