Closed
Bug 894866
Opened 12 years ago
Closed 12 years ago
elementFromPoint returns incorrect element
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: alexanderMos, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Steps to reproduce:
Run page. Element 'li' has padding '0.4em'. In fact, element with className 'test' is placed on (8, 60) coordinates.
Actual results:
document.elementFromPoint(8, 60) returns BODY element, but document.elementFromPoint(8, 61) returns test DIV element
Expected results:
document.elementFromPoint(8, 60) returns DIV element
Updated•12 years ago
|
Attachment #777060 -
Attachment mime type: text/plain → text/html
Updated•12 years ago
|
Component: Untriaged → DOM
Product: Firefox → Core
Comment 1•12 years ago
|
||
> In fact, element with className 'test' is placed on (8, 60) coordinates.
Are you sure? Won't it depend on the exact font rasterizer used? For me (on Mac) that element is at (8, 58). What makes you think it's at (8, 60) for you and not in fact at (8, 61)?
Flags: needinfo?(alexanderMos)
Hi, thank you for your response.
I have tested the page on the Windows 8 64-bit.
Please, look at the attachment 779178 [details] ('identical render, different results').
There are two pages that have only 1 difference: 'li' element's padding ('0.4em' and '5px'). Pages have identical rendering. But 'document.elementFromPoint(8, 60)' calling returns different results.
Comment 5•12 years ago
|
||
The li element in question has "font-size:small". The base font size is 16px, and the page is in standards mode, so "small" ends up being 13px. 0.4*13 == 5.2px, which is not at all the same as 5px.
The rendering can look identical on some devices because of antialiasing and pixel-snapping during painting. But the layout is different: in one case things are 0.2px lower than in the other, so the class="test" thing is at 60.2px, and hit-testing at 60px won't find it.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•