Skip to content

Commit

Permalink
LibWeb: Do not dispatch events to pseudoelement content nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
tcl3 committed Dec 16, 2024
1 parent 108701c commit 88e3a12
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/LibWeb/Page/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static bool parent_element_for_event_dispatch(Painting::Paintable& paintable, GC
continue;
node = layout_node->dom_node();
}
return node && layout_node;
return node && layout_node && !layout_node->is_anonymous();
}

static Gfx::StandardCursor cursor_css_to_gfx(Optional<CSS::Cursor> cursor)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PASS (didn't crash)
17 changes: 17 additions & 0 deletions Tests/LibWeb/Text/input/pseudoelement-content-event-dispatch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<style>
div:before {
content: "test";
translate: 100px;
}
</style>
<div id="test"></div>
<script src="include.js"></script>
<script>
test(() => {
const div = document.getElementById("test");
const rect = div.getBoundingClientRect();
internals.movePointerTo(rect.x + 100, rect.y);
println("PASS (didn't crash)");
});
</script>

0 comments on commit 88e3a12

Please sign in to comment.