dom/events/test/test_draggableprop.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial