W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2019

[csswg-drafts] [cssom-view] {element, elements, nodes}FromPoint but without restricting to the viewport clip? (#4122)

From: Emilio Cobos Álvarez via GitHub <sysbot+gh@w3.org>
Date: Wed, 17 Jul 2019 10:01:06 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-469101058-1563357665-sysbot+gh@w3.org>
emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] {element,elements,nodes}FromPoint but without restricting to the viewport clip? ==
Current spec is: https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface

There was this very old request here: https://lists.w3.org/Archives/Public/www-style/2012Oct/0683.html

This week I was asked for some help with performance of an add-on, which was doing something particularly expensive to see if an element was visible. I suggested that, given a lot of the bottleneck was walking the DOM since it's an extension and it has security wrappers, using `elementFromPoint`-like APIs should speed up stuff, and indeed it did quite a lot. See https://github.com/mozilla/fathom/issues/91.

We have similar non-web-exposed APIs that avoid this clip for various Firefox features, and apparently the best work-around this problem if you're an author resides in using `window.scrollTo` and such. See for example: https://stackoverflow.com/questions/19715620/javascript-get-element-at-point-outside-viewport

The original thread suggests new APIs altogether. I think it'd be better to add some dictionary argument to the existing APIs, something like:

```webidl
dictionary FromPointOptions {
  boolean ignoreViewportClip = false;
}
```

Or such?

While working on this, I could also try to do a bit of spec maintenance, since there's multiple stuff we've resolved on that hasn't been incorporated to the spec. If only, moving these to `DocumentOrShadowRoot`, the `node/nodesFromPoint` APIs discussed in [here](https://github.com/w3c/csswg-drafts/issues/556#issuecomment-433411568).

This also fits nicely for the "include `display: contents` parents" option that people discussed in #556.

Does an API like this make sense to y'all? :)

/cc @tabatkins @zcorpan @smfr 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4122 using your GitHub account
Received on Wednesday, 17 July 2019 10:01:12 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:50 UTC