Bug 67199 - In specific cases, document.elementFromPoint returns wrong element
Summary: In specific cases, document.elementFromPoint returns wrong element
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-30 07:14 PDT by Vincent Bernardi
Modified: 2018-05-28 07:07 PDT (History)
1 user (show)

See Also:


Attachments
HTML source of the page which doesn't add/remove a style element. (63 bytes, text/plain)
2011-08-30 07:14 PDT, Vincent Bernardi
no flags Details
HTML source of the page which does add/remove a style element. (57 bytes, text/plain)
2011-08-30 07:15 PDT, Vincent Bernardi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Bernardi 2011-08-30 07:14:36 PDT
Created attachment 105622 [details]
HTML source of the page which doesn't add/remove a style element.

<http://test.elvanor.net/js/webkit/element_from_point_works.html> (A)
<http://test.elvanor.net/js/webkit/element_from_point.html> (B)

In the above pages, I have a div and a hidden span inside. There's an inline script on both pages which logs what element was clicked using document.elementFromPoint. The script on the second page  (B) also creates a style element, adds it to <head> and removes it instantly. 


I believe the expected logged element (on both pages) when clicking the div is <div>, since the span is hidden.
Expected:
(A): Div
(B): Div

Here's what is logged when clicking on each page:

Chromium 13.0.782.215 (Linux) :
(A): Div
(B): Span

Safari  5.1 (7534.48.3) (Mac OS X 10.7) :
(A): Div
(B): Span

Safari nightly 5.1 (7534.48.3, r94061) (Mac OS X 10.7) :
(A): Span
(B): Span

Google Chrome 13.0.782.215 (Mac):
(A): Div
(B): Span
Comment 1 Vincent Bernardi 2011-08-30 07:15:05 PDT
Created attachment 105623 [details]
HTML source of the page which does add/remove a style element.
Comment 2 Vincent Bernardi 2011-08-30 07:15:51 PDT
Sorry I attached the URLs when I meant to attach the source.
Comment 3 Vincent Bernardi 2012-06-29 02:21:00 PDT
Safari  5.1.7 (7534.57.2) (Mac OS X 10.7) :
(A): Span
(B): Span
Comment 4 Vincent Bernardi 2012-09-07 05:52:23 PDT
Safari  6.0 (8536.25) (Mac OS X 10.8) :
(A): Div
(B): Span
Comment 5 Vincent Bernardi 2013-06-11 06:28:17 PDT
Safari 6.0.4 (8536.29.13) (Mac OS X 10.8.3) :
(A): Span
(B): Span
Comment 6 Vincent Bernardi 2013-11-04 00:45:44 PST
Safari 7.0 (9537.71) (Mac OS X 10.9) :
(A): Span
(B): Span
Comment 7 Vincent Bernardi 2013-11-04 00:48:30 PST
Google Chrome 30.0.1599.101 (Mac):
(A): Div
(B): Div


Bug is now fixed on Chrome and not on Safari.
Comment 8 Vincent Bernardi 2014-06-08 02:04:04 PDT
Safari 7.0.4 (9537.76.4) (Mac OS X 10.9.3) :
(A): Div
(B): Span

...and we're back gain to Safari 5.1's behavior :-)
Comment 9 Vincent Bernardi 2015-09-15 08:13:26 PDT
Safari  8.0.7 (10600.7.12) (Mac OS X 10.10.4) :
(A): Div
(B): Div

Seems the bug is solved for now. What a nice 4 years ride.
Comment 10 Vincent Bernardi 2018-05-28 07:07:19 PDT
Safari  11.1 (13605.1.33.1.4) (Mac OS X 10.13.4 (17E202)) :
(A): Div
(B): Div

My watch has ended.