Re: @else in Media Queries

Mark Brown <[email protected]>
Newsgroups gmane.comp.web.css.general
Message-ID <CAM4AczD9N7ZU1jGbUuEu8fHsJBjZzsRR_03TZbYL=VsFHzQjDQ@mail.gmail.com>
On Fri, Jun 10, 2016 at 6:58 AM, Tab Atkins Jr. <[email protected]> wrote:
> On Thu, Jun 9, 2016 at 3:34 AM, Daniel Glazman <[email protected]> wrote:
>> My recommendation for @else is then the following: yes to @else but
>> we need to have boolean completion in MQs first, to be able to
>> serialize precisely the MQ relevant to a given style rule. That means
>> allowing negated single media features, OR operations and grouping
>> through parentheses. I'm pretty sure we'll have requests for that (if
>> we don't have them yet) anyway.
>
> We already have all of those.

Well, not quite. Florian's example on the issue tracker [1]
illustrates that you can't always write a separate condition that's
equivalent to an else, because of how unknown media features are
handled.

To make the set of operations complete, you could, for example, add a
function such as 'unknown(media-query)' which is true iff its argument
evaluates to unknown. So this doesn't seem a major hurdle.

On Fri, Jun 10, 2016 at 3:34 PM, Daniel Glazman
<[email protected]> wrote:
> The whole things starts smelling like the worst of hacks in CSS. So an
> editor removing one rule (the @media one) will have to carefully look
> if there is an @else after it. To do what? Remove it? Explode it?

Can you explain how this is different from an editor for any other
language with an if-then-else construct?

Mark

[1] https://github.com/w3c/csswg-drafts/issues/112
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.