Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/runtime/captureMotionBlur/filterTier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export function createFilterTier(
defs.setAttribute("data-hf-ignore", "");
defs.style.cssText = "position:absolute;left:0;top:0;pointer-events:none";
node(defs, "defs", {});
root.append(defs);
document.documentElement.append(defs);
}
layer = buildLayer(defs.querySelector("defs") ?? defs, layers.size, el);
layers.set(el, layer);
Expand Down
19 changes: 19 additions & 0 deletions packages/core/src/runtime/captureMotionBlur/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,25 @@ describe("filter fallback", () => {
expect(h.seek.mock.calls.every(([, suppress]) => suppress === true)).toBe(true);
});

it("keeps the filter tier's svg out of the root and removes it on teardown", () => {
const { root, h } = movingHost();
const svgs = () => document.querySelectorAll("svg[data-hf-ignore]").length;
initCaptureMotionBlur(h);
void paintCaptureMotionBlur(0.5, PLAY);
expect(root.querySelector("svg[data-hf-ignore]")).toBeNull();
expect(svgs()).toBe(1);
initCaptureMotionBlur({ ...h, timeline: () => "tl2" });
void paintCaptureMotionBlur(0.6, PLAY);
expect(svgs()).toBe(1);
const next = movingHost();
initCaptureMotionBlur(next.h);
void paintCaptureMotionBlur(0.5, PLAY);
expect(next.root.querySelector("svg[data-hf-ignore]")).toBeNull();
expect(svgs()).toBe(1);
resetCaptureMotionBlurForTests();
expect(svgs()).toBe(0);
});

it("removes its filters and its SVG on teardown", () => {
const { el, h } = movingHost();
initCaptureMotionBlur(h);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const SWEEP_SYMPTOMS = {
F_CAPTURE: 40.62,
F_FILTER: 126.54,
H: 135.67,
I: 53.63,
J: 25.79,
K: MEASURED_ORACLE_SMALLEST_SYMPTOM,
M: 18.31,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@ const CASES: readonly SweepCase[] = [
tier: "filter",
frame: 11,
check: "outside",
bug: {
finding: "I",
reason: "the filter tier's svg becomes the root's last child, so :last-child moves to it",
regions: [rect(0, 0, 0, 0), rect(494, 14, 112, 62)],
measuredMae: S.I,
},
},
{
fixture: "overflow-card",
Expand Down
Loading