3 ms·
Sorry, I actually meant just "element's width" not "parent". But you're right it definitely gets complicated, and you know way better than I do about which piec
by ianstormtaylor 14y ago
Sorry, I actually meant just "element's width" not "parent". But you're right it definitely gets complicated, and you know way better than I do about which pieces are impossible and which aren't :)
The viewport query is a lot easier from an implementors point of view for sure, but it's also a lot less useful from a developer's point of view.
Would it be possible to have a way of only basing the element-specific query off of the state of the element before element-query-level styles had been applied?
For example, take an element that who's height is less than 100px. And say it has a query for `height > 80px` that hid a child element, which then kicked the element's height down to 75px. Technically the query would be undone, but maybe since it is a query-specific change, it doesn't factor in.
And it gets even more complicated when considering well what about a child's or parent's queries on top of that I'm sure.
All I know is while I'm writing these styles, I have very defined things that I want to do, that can be expressed in words perfectly clearly, and if I were able to express them in code it would completely solve tons of headaches I have with managing CSS. Ideally we could figure out a syntax and implementation that can translate those kinds of thoughts into code that works.
- bzbarsky 14y agoIan, the problem is that CSS is a constraint description language, not an imperative language. So there is no "before" or "after"; there's just a state... On the one hand this means that as things change it updates dynamically and all. On the other it means that you can't just base queries on some "before" state. :( I think we all agree that there are use cases that need solving here, for sure. We just need to figure out how to do it... Ideally while not precluding parallelized evaluation of CSS selector matching, style computation, and layout, which doesn't make things any easier.