W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2018

Re: [csswg-drafts] [cssom-view] elementFromPoint, elementsFromPoint, and caretPositionFromPoint should not return an element inside a shadow tree (#556)

From: Emilio Cobos Álvarez via GitHub <sysbot+gh@w3.org>
Date: Mon, 24 Dec 2018 12:52:23 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-449730659-1545655942-sysbot+gh@w3.org>
Regarding duplicated content, it's a bit trickier than that. Right now all engines can return a node twice if you absolutely position some generated content.

For example, the following HTML:

```html
<!doctype html>
<style>
  html, body { margin: 0; }
  div {
    width: 100px;
    height: 100px;
    background: red;
    position: relative;
  }
  span {
    display: inline-block;
    width: 100px;
    height: 100px;
    background: green;
  }
  div::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: rgba(0, 0, 0, .2);
  }
</style>
<div><span></span></div>
<script>
  console.log(document.elementsFromPoint(50, 50));
</script>
```

Will log the `<div>` twice in Gecko, WebKit and Blink.

-- 
GitHub Notification of comment by emilio
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/556#issuecomment-449730659 using your GitHub account
Received on Monday, 24 December 2018 12:52:24 UTC

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