Bug 192621

Summary: messed up scope in eventHandler
Product: WebKit Reporter: g. papa <etasho>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Major CC: ap, cdumez
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Description g. papa 2018-12-12 04:54:47 PST
On Chrome 71 (not on any Chrome before), if an element (select, button) has an inline onclick event with the id (of the element) specified as a parameter of the called function AND this element has children elements, the scope gets messed up and it tries to take the id of the child element.

<select id="myselect" onclick="jsDoSomething(id)"><option>1</option><option>2</option></select>

function jsDoSomething(id) {
   alert(id);
}

Stackoverflow report: https://stackoverflow.com/questions/53740067/chrome-71-does-not-detect-id-in-an-onclick-event-unless-its-this-id/53740954?noredirect=1#comment94335519_53740954
Comment 1 Alexey Proskuryakov 2018-12-12 13:15:11 PST
Chrome has forked WebKit many years ago, so new bugs that appear there are Google's own.

WebKit doesn't appear to even send a click event for selects, as I don't get any alert even after adding <script> around the code.