Re: The :min-width/:max-width pseudo-classes

On Wed, Mar 20, 2013 at 5:41 PM, François REMY <
francois.remy.dev@outlook.com> wrote:

> In the light of a recent blog post [1] of Daniel Buchner, contributor of
> the Web Components specification, I would like to resurrect a thread I
> think is really important: element-based media queries.
>


> [...]



>
>
I'm thinking about adding this proposal in my Local Viewport proposal draft
> in the near future, but I would love to get further feedback on the
> feasibility and the timeframe in which we can hope to get the feature
> implemented. I'm pretty sure that, depending on that, the importance of
> optimizing the 'on layout updated' event loop will prove more or less
> important.
>

This doesn't seem very easy to implement because it breaks the sequential
processing model:

1. resolve style on elements such that you have a flattened set of
properties.
2. layout the elements if things are different then the last time we did
step 1.

The "viewport" is a magical thing outside the <html> element so when you
resize it we can just execute step 1 to pick new selectors based on queries.

Having pseudo classes that match conditionally based on the layout of some
ancestor breaks this model since now you need to keep executing step 1
while doing step 2.

This would be a big undertaking in Webkit so I don't think it falls
anywhere in the near future.


> In the mean time, I propose to standardize the ‘resize’ event of Internet
> Explorer (making it asynchronous and working in a similar fashion to the
> regionlayoutupdate event). Failing to standardize this event will only
> result in a dummy elements used as event trigger, something that is
> probably even worse from the performance point of view.
>
>
This seems reasonable, but I think you're going to want end of micro task
semantics to make this work properly.

- E

Received on Thursday, 21 March 2013 19:09:26 UTC