Re: [csswg-drafts] [css-selectors] Reference selectors (#3714)

Really, being able to discuss some of this seems to, in my mind at least, hinge on what it would actually mean to associate an element with a reference and why/how you might do that in practice, but almost all of these have inline questions in @justinfagnani's original post. 

Would it be productive to talk details on some of those things?  I feel like it is sort of impossible to even ask good questions with only vague ideas on what seem like kind of ultimately maybe the most critical points.  It's also possible I am missing something important here and over-stating, but... for example..

If I had 

```css
/* styles.css */
$foo { color: yellow; }
$foo { background-color: blue; }
@media only screen and (max-width: 480px) {
  $foo {
    background-color: black;
  }
}
```

and

```css
/* app.js */
import {foo} from './styles.css';
document.querySelector('#app').cssReferences=[foo];
```

and

```html
<style>main { background-color: purple; }</style>
<script type="module" src="app.js"></script>
<main id="app">
   Hello
</main>
```

Can someone explain what color do we expect the foreground and background to be, and why?  If there were agreement on that that I could wrap my head around, I feel like this would be a little easier to discuss.

Also, at the end of this

* It seems like you _need_ to be able to indicate in HTML itself that this thing applies over here.  Is that not correct?  
   * It seems like the value of that would have to be DOMTokenList?
   * Then we create another way to assign 'references' that interact with this via a diff API somehow? Do they reflect or ...?
   * At the end of all of this, it seems CSS is/can still act on those and the cascade and all kind of still plays into it?  It seems you could totally write `[css-refs="$foo"]` in your stylesheet or qSA?

Is it possible that classes + some things in other proposals could be 'enough'?  Like maybe stuff in https://tabatkins.github.io/specs/css-aliases/ provides interesting ideas?  If you can alias classes with pseudo-names, we could maybe both export those and have consistent specificity, and use that to also chase the 'how to match' end of this as well, all in one? 



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

Received on Friday, 8 March 2019 18:35:23 UTC