diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/events/test/file_bug1446834.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/events/test/file_bug1446834.html')
-rw-r--r-- | dom/events/test/file_bug1446834.html | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/dom/events/test/file_bug1446834.html b/dom/events/test/file_bug1446834.html new file mode 100644 index 0000000000..e3832fd2f0 --- /dev/null +++ b/dom/events/test/file_bug1446834.html @@ -0,0 +1,96 @@ +<html> + <head> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <script> + + function lazyRequestAnimationFrame(fn) { + requestAnimationFrame( + function() { + setTimeout(fn); + }); + } + + var tests = [ removeHost, removeShadowElement ]; + function nextTest() { + if (tests.length) { + var test = tests.shift(); + lazyRequestAnimationFrame(test); + } else { + parent.SimpleTest.finish(); + } + } + + function removeHost() { + var hostgrandparent = document.getElementById("hostgrandparent"); + var hostparent = document.getElementById("hostparent"); + hostparent.innerHTML = "<div id='host'></div>"; + var host = document.getElementById("host"); + var sr = document.getElementById("host").attachShadow({mode: "open"}); + sr.innerHTML = "<input type='button' value='click'>"; + sr.firstChild.onclick = function() { + parent.is(hostparent.querySelector("div:hover"), host, "host should be hovered."); + host.remove(); + parent.is(hostgrandparent.querySelector("div:hover"), hostparent, + "hostgrandparent element should have descendants marked in :hover state."); + synthesizeMouseAtCenter(document.getElementById('light'), { type: "mousemove" }); + lazyRequestAnimationFrame( + function() { + parent.is(hostgrandparent.querySelector("div:hover"), null, + "hostgrandparent element shouldn't have descendants marked in :hover state anymore."); + nextTest(); + } + ); + } + lazyRequestAnimationFrame( + function() { + synthesizeMouseAtCenter(sr.firstChild, { type: "mousemove" }); + synthesizeMouseAtCenter(sr.firstChild, {}); + } + ); + } + + function removeShadowElement() { + var hostgrandparent = document.getElementById("hostgrandparent"); + var hostparent = document.getElementById("hostparent"); + hostparent.innerHTML = "<div id='host'><input id='input' slot='slot' type='button' value='click'></div>"; + var host = document.getElementById("host"); + var input = document.getElementById("input"); + var sr = document.getElementById("host").attachShadow({mode: "open"}); + sr.innerHTML = "<div><div><slot name='slot'></slot></div></div>"; + var shadowOuterDiv = sr.firstChild; + var shadowInnerDiv = shadowOuterDiv.firstChild; + var slot = shadowInnerDiv.firstChild; + sr.firstChild.onclick = function() { + parent.is(hostparent.querySelector("div:hover"), host, "host should be hovered."); + slot.remove(); + parent.is(shadowOuterDiv.querySelector("div:hover"), shadowInnerDiv, + "Elements in shadow DOM should stay hovered"); + synthesizeMouseAtCenter(document.getElementById('light'), { type: "mousemove" }); + lazyRequestAnimationFrame( + function() { + parent.is(shadowOuterDiv.querySelector("div:hover"), null, + "Shadow DOM shouldn't be marked to be hovered anymore."); + nextTest(); + } + ); + } + lazyRequestAnimationFrame( + function() { + synthesizeMouseAtCenter(input, { type: "mousemove" }); + synthesizeMouseAtCenter(input, {}); + } + ); + } + </script> + <style> + </style> + </head> + <body onload="nextTest()"> + <div id="hostgrandparent"> + <div id="hostparent"> + </div> + foo + </div> + <div id="light">light dom</div> + </body> +</html>
\ No newline at end of file |