Bug 192621 - messed up scope in eventHandler
Summary: messed up scope in eventHandler
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-12 04:54 PST by g. papa
Modified: 2018-12-12 13:15 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.