Bug 178002 - Retargeting algorithm is not correctly running in elementFromPoint
Summary: Retargeting algorithm is not correctly running in elementFromPoint
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 11
Hardware: Macintosh Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2017-10-06 01:47 PDT by elkurin
Modified: 2018-09-20 19:55 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description elkurin 2017-10-06 01:47:55 PDT
elementFromPoint bug
shadowRoot.elementFromPoint(a host child which is the text node) should return the host node but now is returning the assigned slot node instead.

JS Code:
http://jsbin.com/pelidinuka/1/edit?html,js,output

According to the shadow dom spec 7.1 NOTE, elementFromPoint runs the Retargeting Algorithm.
Retargeting Algorithm is described in this URL.
https://w3c.github.io/webcomponents/spec/shadow/#retarget

By running this algorithm, the selected node itself (in this case, the parent of the node because the node is the text node) should be returned.
Comment 1 Radar WebKit Bug Importer 2018-08-01 22:41:26 PDT
<rdar://problem/42843001>
Comment 2 Ryosuke Niwa 2018-09-20 19:55:28 PDT
Here's a summary of the issue.

When the text node is the result of hit testing, and it is assigned to a slot, Chrome returns the host presumably because Blink doesn't return a text node as the result of hitting as noted in https://github.com/w3c/csswg-drafts/issues/556#issuecomment-369815892

However, the current behavior of WebKit matches that of Gecko whereas the behavior in Chrome is that we return the host element because . It's likely that we want to keep the current behavior of WebKit instead of alining to Chrome.