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 | <html> |
michael@0 | 2 | <head> |
michael@0 | 3 | <title>Tests for the draggable property on HTML elements</title> |
michael@0 | 4 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> |
michael@0 | 5 | <script type="application/javascript" |
michael@0 | 6 | src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 7 | |
michael@0 | 8 | <body> |
michael@0 | 9 | <p id="display"></p> |
michael@0 | 10 | <div id="content" style="display: none"> |
michael@0 | 11 | </div> |
michael@0 | 12 | |
michael@0 | 13 | <span id="elem1">One</span> |
michael@0 | 14 | <span id="elem2" draggable="true">Two</span> |
michael@0 | 15 | <span id="elem3" draggable="">Three</span> |
michael@0 | 16 | <span id="elem4" draggable="false">Four</span> |
michael@0 | 17 | <span id="elem5" draggable="other">Five</span> |
michael@0 | 18 | |
michael@0 | 19 | <img id="img1" src="../happy.png"> |
michael@0 | 20 | <img id="img2" src="../happy.png" draggable="true"> |
michael@0 | 21 | <img id="img3" src="../happy.png" draggable=""> |
michael@0 | 22 | <img id="img4" src="../happy.png" draggable="false"> |
michael@0 | 23 | <img id="img5" src="../happy.png" draggable="other"> |
michael@0 | 24 | |
michael@0 | 25 | <a id="a1">One</a> |
michael@0 | 26 | <a id="a2" draggable="true">Two</a> |
michael@0 | 27 | <a id="a3" draggable="">Three</a> |
michael@0 | 28 | <a id="a4" draggable="false">Four</a> |
michael@0 | 29 | <a id="a5" draggable="other">Five</a> |
michael@0 | 30 | |
michael@0 | 31 | <a id="ahref1" href="http://www.mozilla.org">One</a> |
michael@0 | 32 | <a id="ahref2" href="http://www.mozilla.org" draggable="true">Two</a> |
michael@0 | 33 | <a id="ahref3" href="http://www.mozilla.org" draggable="">Three</a> |
michael@0 | 34 | <a id="ahref4" href="http://www.mozilla.org" draggable="false">Four</a> |
michael@0 | 35 | <a id="ahref5" href="http://www.mozilla.org" draggable="other">Five</a> |
michael@0 | 36 | |
michael@0 | 37 | <script> |
michael@0 | 38 | function check() |
michael@0 | 39 | { |
michael@0 | 40 | try { |
michael@0 | 41 | checkElements(1, false, true, false, true); |
michael@0 | 42 | checkElements(2, true, true, true, true); |
michael@0 | 43 | checkElements(3, false, true, false, true); |
michael@0 | 44 | checkElements(4, false, false, false, false); |
michael@0 | 45 | checkElements(5, false, true, false, true); |
michael@0 | 46 | } |
michael@0 | 47 | catch (ex) { |
michael@0 | 48 | is("script error", ex, "fail"); |
michael@0 | 49 | } |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | function checkElements(idx, estate, istate, astate, ahrefstate) |
michael@0 | 53 | { |
michael@0 | 54 | checkElement("elem" + idx, estate, false); |
michael@0 | 55 | checkElement("img" + idx, istate, true); |
michael@0 | 56 | checkElement("a" + idx, astate, false); |
michael@0 | 57 | checkElement("ahref" + idx, ahrefstate, true); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | function checkElement(elemid, state, statedef) |
michael@0 | 61 | { |
michael@0 | 62 | var elem = document.getElementById(elemid); |
michael@0 | 63 | |
michael@0 | 64 | is(elem.draggable, state, elemid + "-initial"); |
michael@0 | 65 | elem.draggable = true; |
michael@0 | 66 | is(elem.draggable, true, elemid + "-true"); |
michael@0 | 67 | elem.draggable = false; |
michael@0 | 68 | is(elem.draggable, false, elemid + "-false"); |
michael@0 | 69 | |
michael@0 | 70 | elem.setAttribute("draggable", "true"); |
michael@0 | 71 | is(elem.draggable, true, elemid + "-attr-true"); |
michael@0 | 72 | elem.setAttribute("draggable", "false"); |
michael@0 | 73 | is(elem.draggable, false, elemid + "-attr-false"); |
michael@0 | 74 | elem.setAttribute("draggable", "other"); |
michael@0 | 75 | is(elem.draggable, statedef, elemid + "-attr-other"); |
michael@0 | 76 | elem.setAttribute("draggable", ""); |
michael@0 | 77 | is(elem.draggable, statedef, elemid + "-attr-empty"); |
michael@0 | 78 | elem.removeAttribute("draggable"); |
michael@0 | 79 | is(elem.draggable, statedef, elemid + "-attr-removed"); |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | check(); |
michael@0 | 83 | |
michael@0 | 84 | </script> |
michael@0 | 85 | |
michael@0 | 86 | </body> |
michael@0 | 87 | </html> |
michael@0 | 88 | |
michael@0 | 89 |