diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/dom/nodes | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
2 files changed, 48 insertions, 15 deletions
diff --git a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-default-style-meta-from-fragment.tentative.html b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-default-style-meta-from-fragment.tentative.html index a9b7ba633e..fa4a987751 100644 --- a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-default-style-meta-from-fragment.tentative.html +++ b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-default-style-meta-from-fragment.tentative.html @@ -7,29 +7,53 @@ <div id="div">hello</div> <script> let scriptRan = false; -let computedStyleDuringInsertion = null; +let computedStyleInPreScript = null; +let computedStyleInPostScript = null; test(() => { const div = document.getElementById("div"); + + // 1. Gets inserted *before* the `<meta>` tag. Cannot observe the meta tag's + // effect, because this script runs before the meta tag's post-insertion steps + // run, and the meta tag's post-insertion steps is where the default style + // sheet actually changes. + const preScript = document.createElement("script"); + preScript.textContent = ` + computedStyleInPreScript = getComputedStyle(div).display; + scriptRan = true; + `; + + // 2. The `<meta>` tag itself. const meta = document.createElement("meta"); meta.httpEquiv = "default-style"; meta.content = "alternative"; - const script = document.createElement("script"); - script.textContent = ` - computedStyleDuringInsertion = getComputedStyle(div).display; + + // 3. Gets inserted *after* the `<meta>` tag. Observes the meta tag's effect, + // because this script runs after the meta tag's post-insertion steps, which + // has the script-observable change to the default style sheet. + const postScript = document.createElement("script"); + postScript.textContent = ` + computedStyleInPostScript = getComputedStyle(div).display; scriptRan = true; `; + const df = document.createDocumentFragment(); - df.appendChild(script); - df.appendChild(meta); - assert_equals(getComputedStyle(div).display, "block", "div has block display"); + df.append(preScript, meta, postScript); + + assert_equals(getComputedStyle(div).display, "block", + "div still has block display before meta insertion"); assert_false(scriptRan, "script has not run before insertion"); + document.head.appendChild(df); assert_true(scriptRan, "script has run after insertion"); - assert_equals(computedStyleDuringInsertion, "none", - "display: none; style was applied during DOM insertion, before " + - "later-inserted script runs"); + assert_equals(computedStyleInPreScript, "block", + "display: none; style was NOT applied during DOM insertion steps, " + + "before earlier-inserted script post-insertion steps run"); + assert_equals(computedStyleInPostScript, "none", + "display: none; style WAS applied during DOM post-insertion steps, " + + "before later-inserted script runs"); assert_equals(getComputedStyle(div).display, "none", "style remains display: none; after insertion"); + }, "Inserting <meta> that uses alternate stylesheets, applies the style " + - "during DOM insertion, and before script runs as a result of any atomic insertions"); + "during DOM post-insertion steps"); </script> diff --git a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/blur-event.window.js b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/blur-event.window.js index 4c8cd85cbf..fdca02dcda 100644 --- a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/blur-event.window.js +++ b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/blur-event.window.js @@ -12,8 +12,17 @@ test(() => { const button = document.body.appendChild(document.createElement('button')); button.focus(); - let blurCalled = false; - button.onblur = e => blurCalled = true; + let blur_called = false; + let focus_out_called = false; + let focus_called = false; + + button.onblur = () => { blur_called = true; } + button.onfocusout = () => { focus_out_called = true; } + document.body.addEventListener("focus", + () => { focus_called = true; }, {capture: true}); button.remove(); - assert_false(blurCalled, "Blur event was not fired"); -}, "<button> element does not fire blur event upon DOM removal"); + + assert_false(blur_called, "Blur event was not fired"); + assert_false(focus_out_called, "FocusOut event was not fired"); + assert_false(focus_called, "Focus was not fired"); +}, "<button> element does not fire blur/focusout events upon DOM removal"); |