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

Support new syntax #12

Closed
bramus opened this issue Dec 3, 2021 · 3 comments
Closed

Support new syntax #12

bramus opened this issue Dec 3, 2021 · 3 comments

Comments

@bramus
Copy link

bramus commented Dec 3, 2021

As per tweet by @mirisuzanne:

⚠️ Existing Container Query demos are broken in the latest Chrome Canary. It's just a small syntax change:

🥳 We're adding the ability to query container styles, not just size size. So we have to be explicit about query type, eg:

size(min-width: 30em) and style(--card: large)

(Can't seem to find an issue/commit that mentions this 1, so this tweet will have to do for now)

An example CQ would be:

@container size(width >= 30em) {
  …
}

Footnotes

  1. https://github.com/w3c/csswg-drafts/issues/6393 should be the one, though.

@surma
Copy link
Collaborator

surma commented Dec 4, 2021

According to the spec, that’s additional syntax, so I’m surprised things are breaking?

But yes, I might look into adding support for the (imho superior) (width > 50px) syntax. Actually, style(...) shouldn’t be too hard to do either.

@surma
Copy link
Collaborator

surma commented Dec 6, 2021

Correction, the spec now has the old syntax removed. I’ll leave support in the polyfill, tho.

@surma
Copy link
Collaborator

surma commented Dec 6, 2021

I added support for the size() syntax. I also added syntactic support for style() queries, but haven’t implemented them as there’s no good way to observe computed style changes on the platform afaict.

This is all published in v0.1.1. Closing this :)

@surma surma closed this as completed Dec 6, 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

No branches or pull requests

2 participants