- From: Sebastian Zartner <sebastianzartner@gmail.com>
- Date: Mon, 29 Oct 2012 06:55:53 +0100
- To: Shane Stephens <shans@google.com>
- Cc: "Edward O'Connor" <eoconnor@apple.com>, www-style list <www-style@w3.org>
- Message-ID: <CAERejNbu9b=XL54uAzs+Fp5fV+fjVHj0B52dKF=ytRM+8y9wig@mail.gmail.com>
On Mon, Oct 29, 2012 at 6:21 AM, Shane Stephens <shans@google.com> wrote: > On Fri, Oct 26, 2012 at 5:34 PM, Sebastian Zartner < > sebastianzartner@gmail.com> wrote: > >> I don't think it's a good idea to have document.elementFromPoint take >>> viewport coordinates but document.elementsFromPoint take document >>> coordinates. >>> >> Uhm, who said document.elementsFromPoint() would take document >> coordinates? Did you mean <element>.caretPositionFromPoint()? If so, how >> to solve the overlapping problem then? >> > > Ted initiated this thread by asking for naming suggestions for a method > similar to document.elementFromPoint that operates with document > coordinates. You replied to this thread... > Oops, I completely missed that document.elementFromPoint() and caretPositionFromPoint() are already defined in the current draft and he was asking for another method, which takes document coordinates. This was mainly because of not reading the request well, but also because he didn't provide the link to it[1]. Ok, so my suggestion to Ted's request is to add another parameter to the existing functions defining the origin, which can either be "viewport" or "document" and will default to "viewport". This gives some extensibility in the future by allowing to add other origins like e.g. "parent". "viewport" or "document". This would make them extensible by allowing to > add other values in the future like "parent". > > Btw. what is caretPositionFromPoint() expected to return? A character >> offset? >> >> >> I think elementsFromPoint isn't a great name >>> >> How about getElementsAtPoint() and getCaretPositionAtPoint() to be >> consistent with similar functions? >> > > Maybe it would be better to respond to Ted's requests here, and start a > new thread discussing the possibility of variants of elementFromPoint and > caretPositionFromPoint that return multiple values? Otherwise we risk > confusion, not to mention losing sight of the original request. > My point is still that these functions should be replaced by some being able to return several elements and are named according to related functions. So yes, I'll create a new thread for this. Sorry for the misunderstanding! Sebastian [1] http://www.w3.org/TR/cssom-view/#extensions-to-the-document-interface
Received on Monday, 29 October 2012 05:56:50 UTC