Bug 278150

Summary: Missed click event when innerHTML addition assignment overwrites the container child nodes
Product: WebKit Reporter: Lauro Moura <lmoura>
Component: UI EventsAssignee: Abrar Rahman Protyasha <a_protyasha>
Status: NEW    
Severity: Normal CC: karlcow, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=118743

Lauro Moura
Reported 2024-08-14 22:15:09 PDT
Example: - Mouse listeners on document - Listeners append text nodes + br to a div with `container.innerHTML += ...` Expected result (based on tests with Chromium and Firefox, not sure if it's covered by the spec, though): - Clicking the div content triggers mousedown+mouseup+click in sequence Actual result (tested with multiple WPE browsers, as of 282132@main): - Only mousedown+mouseup get emitted. - Click emission gets stopped in EventHandler.cpp::targetNodeForClickEvent(mousePressNode, mouseReleaseNode), with mousePressNode (through m_clickNode) null, as it gets replaced in the += operation of the JS listener. Using `container.insertAdjacentHTML("beforeend", ...)` allows the originating nodes to live and the click gets delivered. Is this a bug on WebKit side or is it something not yet covered by the spec? (Example incoming)
Attachments
Karl Dubost
Comment 1 2024-08-19 22:59:51 PDT
Laura, it would be great if you could upload a test case for this.
Radar WebKit Bug Importer
Comment 2 2024-08-21 22:16:13 PDT
Note You need to log in before you can comment on or make changes to this bug.