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

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

From: Emilio Cobos Álvarez via GitHub <sysbot+gh@w3.org>
Date: Fri, 08 Nov 2019 12:07:55 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-551679440-1573214874-sysbot+gh@w3.org>
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:

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

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

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