Re: [csswg-drafts] [all] Feature detection for CSS property support on certain elements (#4498)

Probably not a solution for already existing stuff, but I think when we expand support for one property to a different set of use-cases (like `gap` for flex containers, the `clip-path` for HTML content, etc...) we could define new feature queries in `@supports` or such to allow feature-detecting them.

Though `gap-in-flex` is feature-detectble via layout queries... I think `clip-path` may be feature-detectable by `elementFromPoint`? From a quick test it does affect hit-testing so something like this seems to work:

```html
<!doctype html>
<style>
  body {
    margin: 0;
  }
  div {
    width: 100px;
    height: 100px;
    background-color: green;
    clip-path: inset(50px);
  }
<div></div>
<script>
  const clipPathInHtmlSupported = document.getElementFromPoint(50, 50) != document.querySelector("div");
</script>
```

Obviously not amazing, but I think it can work. For new stuff I'd propose using new `@supports` queries... `@supports feature(clip-path-in-html)`, `@supports feature(gap-in-flex)`?

-- 
GitHub Notification of comment by emilio
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4498#issuecomment-551679440 using your GitHub account

Received on Friday, 8 November 2019 12:07:57 UTC