W3C home > Mailing lists > Public > public-css-archive@w3.org > April 2017

Re: [csswg-drafts] Quantity Queries Proposal

From: Tommy Hodgins via GitHub <sysbot+gh@w3.org>
Date: Thu, 06 Apr 2017 19:40:35 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-292291310-1491507634-sysbot+gh@w3.org>
Imagine if `:has()` was as easy to implement as one of these examples:

```css
/* Emulating section:has(h2) */

/* if (condition) "selector" */
@element 'section' {
  eval('if (querySelector("h2")) "$this"') {
    border: 1px solid lime;
  }
}

/* condition ? "selector" : "" */
@element 'section' {
  eval('querySelector("h2") ? "$this" : ""') {
    box-shadow: purple 10px 10px 0;
  }
}

/* condition && "selector" */
@element 'section' {
  eval('querySelector("h2") && "$this"') {
    background: darkblue;
  }
}
```

Working demo: http://codepen.io/tomhodgins/pen/yMpdOz

-- 
GitHub Notification of comment by tomhodgins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1176#issuecomment-292291310 using your GitHub account
Received on Thursday, 6 April 2017 19:40:41 UTC

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