tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

pointermove_after_pointerover_target_removed.tentative.html (4756B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
      6 <title>`pointermove` (maybe) should not be fired when the last `pointerover` target is removed</title>
      7 <script src=/resources/testharness.js></script>
      8 <script src=/resources/testharnessreport.js></script>
      9 <script src=/resources/testdriver.js></script>
     10 <script src=/resources/testdriver-actions.js></script>
     11 <script src=/resources/testdriver-vendor.js></script>
     12 <script>
     13 "use strict";
     14 
     15 /**
     16 * When `pointerover` event target is removed, `pointermove` event is not fired
     17 * on Chrome 134.  Until the behavior is well defined, we should keep the
     18 * compatibility with Chrome.
     19 */
     20 
     21 addEventListener("DOMContentLoaded", () => {
     22  const grandparentDiv = document.getElementById("grandparent");
     23  let parentDiv = document.getElementById("parent");
     24  let childDiv = document.getElementById("child");
     25 
     26  promise_test(async () => {
     27    const childRect = childDiv.getBoundingClientRect();
     28    let pointerMoveTarget;
     29    childDiv.addEventListener("pointerover", () => {
     30      childDiv.remove();
     31      grandparentDiv.addEventListener("pointermove", event => {
     32        pointerMoveTarget = event.target;
     33      }, {once: true});
     34    }, {once: true});
     35    await new test_driver.Actions()
     36      .pointerMove(1, 1, {})
     37      // pointermove will be fired after pointerover removes the child.
     38      .pointerMove(childRect.x + childRect.width / 2, childRect.y + childRect.height / 2, {})
     39      .send();
     40    assert_equals(pointerMoveTarget, undefined);
     41    await new test_driver.Actions()
     42      .pointerMove(1, 1, {})
     43      .send();
     44    parentDiv.appendChild(childDiv);
     45  }, `"pointermove" should not be fired when the preceding "pointerover" caused removing its target`);
     46 
     47  promise_test(async () => {
     48    const childRect = childDiv.getBoundingClientRect();
     49    let pointerMoveTarget;
     50    childDiv.addEventListener("pointerover", () => {
     51      childDiv.outerHTML = childDiv.outerHTML;
     52      childDiv = parentDiv.querySelector("div");
     53      grandparentDiv.addEventListener("pointermove", event => {
     54        pointerMoveTarget = event.target;
     55      }, {once: true});
     56    }, {once: true});
     57    await new test_driver.Actions()
     58      .pointerMove(1, 1, {})
     59      // pointermove will be fired after pointerover replaces the child.
     60      .pointerMove(childRect.x + childRect.width / 2, childRect.y + childRect.height / 2, {})
     61      .send();
     62    assert_equals(pointerMoveTarget, undefined);
     63    await new test_driver.Actions()
     64      .pointerMove(1, 1, {})
     65      .send();
     66  }, `"pointermove" should not be fired when the preceding "pointerover" caused replacing its target`);
     67 
     68  promise_test(async () => {
     69    const childRect = childDiv.getBoundingClientRect();
     70    let pointerMoveTarget;
     71    childDiv.addEventListener("pointerover", () => {
     72      parentDiv.remove();
     73      grandparentDiv.addEventListener("pointermove", event => {
     74        pointerMoveTarget = event.target;
     75      }, {once: true});
     76    }, {once: true});
     77    await new test_driver.Actions()
     78      .pointerMove(1, 1, {})
     79      // pointermove will be fired after pointerover removes the child.
     80      .pointerMove(childRect.x + childRect.width / 2, childRect.y + childRect.height / 2, {})
     81      .send();
     82    assert_equals(pointerMoveTarget, undefined);
     83    await new test_driver.Actions()
     84      .pointerMove(1, 1, {})
     85      .send();
     86    grandparentDiv.appendChild(parentDiv);
     87  }, `"pointermove" should not be fired when the preceding "pointerover" caused removing the parent of its target`);
     88 
     89  promise_test(async () => {
     90    const childRect = childDiv.getBoundingClientRect();
     91    let pointerMoveTarget;
     92    childDiv.addEventListener("pointerover", () => {
     93      parentDiv.outerHTML = parentDiv.outerHTML;
     94      parentDiv = grandparentDiv.querySelector("div");
     95      grandparentDiv.addEventListener("pointermove", event => {
     96        pointerMoveTarget = event.target;
     97      }, {once: true});
     98    }, {once: true});
     99    await new test_driver.Actions()
    100      .pointerMove(1, 1, {})
    101      // pointermove will be fired after pointerover removes the child.
    102      .pointerMove(childRect.x + childRect.width / 2, childRect.y + childRect.height / 2, {})
    103      .send();
    104    assert_equals(pointerMoveTarget, undefined);
    105    await new test_driver.Actions()
    106      .pointerMove(1, 1, {})
    107      .send();
    108  }, `"pointermove" should not be fired when the preceding "pointerover" caused replacing the parent of its target`);
    109 }, {once: true});
    110 
    111 </script>
    112 </head>
    113 <body style="padding-top: 32px">
    114  <div id="grandparent" style="width: 32px; height: 32px;">
    115    <div id="parent" style="width: 32px; height: 32px;">
    116      <div id="child" style="width: 32px; height: 32px;">
    117      </div>
    118    </div>
    119  </div>
    120 </body>
    121 </html>