This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
cssom-view now has the following extensions to Document[1]: partial interface Document { Element? elementFromPoint(double x, double y); sequence<Element> elementsFromPoint(double x, double y); CaretPosition? caretPositionFromPoint(double x, double y); }; Only elementFromPoint is currently defined on ShadowRoot. The best way forward would be to define this in cssom but, until then, can we add the following methods to ShadowRoot? sequence<Element> elementsFromPoint(double x, double y); CaretPosition? caretPositionFromPoint(double x, double y); They could be defined in roughly the same way as elementFromPoint. [1] http://dev.w3.org/csswg/cssom-view/#dom-document-elementfrompoint
Agreed. Sounds the spec needs to reflect the change of cssom-view.
Instead of defining these in Shadow Root as well as in Document, I've started to feel that it'd be better that we have the common interface between Document and Shadow Root. e.g. interface NodeTreeRoot { Element? elementFromPoint(double x, double y); sequence<Element> elementsFromPoint(double x, double y); CaretPosition? caretPositionFromPoint(double x, double y); Selection? getSelection (); readonly attribute Element? activeElement; readonly attribute StyleSheetList styleSheets; }; Document implements NodeTreeRoot; ShadowRoot implements NodeTreeRoot;
@Hayato, that sounds reasonable to me. Can we make it so? :)
(In reply to Philip Rogers from comment #3) > @Hayato, that sounds reasonable to me. Can we make it so? :) Yeah, we can do it, however, we have to rewrite each behavior of each API so that it also considers shadow trees as well as the document. That's not so difficult, but let me put this on my task queue for now.
Make ShadowRoot have elementsFromPoints and caretPositionFromPoint tentatively at: https://github.com/w3c/webcomponents/commit/3df488859776f0f1cd4a17b5c564cf6165584cb9 In the long term, we should have the common interface between Document and ShadowRoot.
I'm aware that these are tentative definitions. However, it would serve the most of our purposes for a while, I hope.
Let me close this bug. I've filed a bug for comment #2 as https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493