Hi, Can you explain to me what you mean with "parse-time declarative macros"? like for instance give an example. In WebKit/Blink the engine knows which media features change as a result of viewport changes and it only reevaluates those when the viewport changes (size, scale/zoom, etc). If the engine knows then invented conditionals change, we could do similar. Kenneth On Sun, Jun 2, 2013 at 7:24 AM, Simon Sapin <simon.sapin@exyr.org> wrote: > Le 01/06/2013 03:07, Tab Atkins Jr. a écrit : > > Recently there was a thread about reducing the duplication in Media >> Queries, which wanted to use Variables. I pointed out that we >> couldn't use CSS Variables as written, but I'd like to pursue lexical >> variables at some point in the future for this kind of thing. >> >> Alex Russell just suggested another approach to me in a private email >> - crack open MQs themselves and let authors plug into that >> infrastructure. Example syntax: >> >> <html> >>> <script> >>> if (window.outerWidth >= 600) >>> document.css.properties["**inventedConditional"] = true; >>> } >>> </script> >>> <style> >>> @media (property("**inventedConditional")) { >>> .facet_sidebar { >>> display: none; >>> } >>> } >>> </style> >>> </html> >>> >> > Hi, > > I like the idea of custom MQs, but the downside of this approach is that > it is not declarative. The example above is very misleading: unlike > existing MQs, this one is not updated when the size of the viewport > changes. The JS code would need to be inside some event handler. > > So this approach has the same kind of performance issues than JS > animations vs. CSS Animations. When this is just a shorter and DRY way to > write a condition that can be expressed with existing MQs, the perf cost > could be greater than the maintenance cost of repetition. > > I think it is worthwhile to have both custom MQs like this (that probably > can’t be made declarative without loosing expressive power) and parse-time > declarative "macros" for MQs to avoid repeating complex expressions. > > -- > Simon Sapin > > -- Kenneth Rohde Christiansen Senior Engineer, WebKit, Qt, EFL Phone +45 4294 9458 / E-mail kenneth at webkit.org ﹆﹆﹆Received on Sunday, 2 June 2013 11:17:23 UTC
This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:30 UTC