Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add invalidation discussion summary #9

Merged
merged 22 commits into from Oct 8, 2021
Merged

Conversation

byung-woo
Copy link
Contributor

No description provided.


1. **Interactions** -- Hovering a button within a card makes the card style change (i.e. background color, border, or even interaction like having a shine animation gloss over it). Sure you can solve this when a single card has a single action, but what happens when that card has multiple actions? You need JS for that.
2. **States** -- Styling things like containers with certain states (i.e. "empty" or "pending") is either not consistent (:empty/:not:empty due to elements vs text nodes and whitespace), or not possible in CSS. Say you want an empty state experience and in your JS you populate an Inbox with a cute message that says "Yay you've reached Inbox 0!". You may want to style the page a certain way, detecting when the child class is present. I.e. if .empty-message is present, it's parent/ancestor .inbox-container could get a style, like a sunshine background. JS is currently required for that.
3. **Pairings** -- Say you have a shopping card. The shopping card has a "Buy" button. The buy button may be :disabled when the item is sold out. It would be nice to be able to style either the parent card or any parent element with the "Sold Out" style. JS is currently required for that. (I guess this is also a state example)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure these are honestly the best use cases articulations, and I agee with this "I guess this is also a state example" because the state example itself is wonky

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes right. There can be other best cases. But in the previous conversations of the mailing thread, the use cases seemed to appear to be reasonable to consider as representative examples of many cases. So I just added those to keep our communication progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding additional explanation like this?
#13

* Allow `:has()` argument starts with `>`
* Allow `:has()` argument starts with descendant combinator
* Allow attribute/elemental selectors in `:has()`
* Allow compound selector in `:has()`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should say allow compound selectors of attribute and elemental selectors, right? I think the thing here is we are talking about allow, but it is unclear that everything else not explicitly stated is disallowed - which is why my email stated some of that, I guess

Copy link
Contributor Author

@byung-woo byung-woo Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be clear to think about the each criteria as independant.

There can be lots of variations if we need to mention all the cases - 'Allowing compound of attribute and elemental selectors', 'Allowing compound of attribute and elemental selectors and user action pseudo classes', ...

By combining the 3rd and 4th criteria, we can make the 'compound of attribute and elemental selectors'. I think this is more clear to focus to the complexity or performance impact on 'Allowing compound' if there are some arguable point on this criteria.


| Criteria | Example |
| :----------- | :----- |
| Allow `:has()` argument starts with `>` ? | `.hero:has(> img)` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to the comment on 141, this is a little confusing - the statement preceeding talks about limitations, but all of these begin with allow (the opposite of a limitation and somewhat repititous). I'm not sure what this matrix is defining, exactly...

Copy link
Contributor Author

@byung-woo byung-woo Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get the limitation of 'Disallow something' that mentioned below (line 156~), I tried to get criteria that can split the selector expression into two group - a group from allowing something, the other group from disallowing something.

So the criteria "Allow :has() argument starts with >" splits all the selector expressions to these group

  • selectors that have leftmost child combinator in :has() argument.
  • selectors that don't have leftmost child combinator in :has() argument.

Then we can focus complexity or performance impact when we try to support the selectors with the leftmost child combinator in :has() argument. Or, we can focus complexity or performance impact of some other approach that supports the opposite case (selectors without the leftmost child combinator in :has() argument). And with the complexity or performance impact, we can say that, when we have limitation of not supporting leftmost child combinator, we may have this kind of (amount of) advantages.

When we have some discussions about a limitation, it would be better to minimize the variations to focus the complexity or performance impact of that limitation. So I tried to get the independant criteria that can split the selector usages as simple as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding this explanations for that?
#12

@byung-woo
Copy link
Contributor Author

Merged sub PRs to remove some branches.

@byung-woo byung-woo closed this Oct 7, 2021
@byung-woo
Copy link
Contributor Author

Remove this from explainer

@byung-woo byung-woo reopened this Oct 8, 2021
@byung-woo byung-woo merged commit 3a17211 into main Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants