Re: @else in Media Queries

"Tab Atkins Jr." <[email protected]> Wed, 22 Jun 2016 12:06:32 -0700
Newsgroups gmane.comp.web.css.general
Message-ID <CAAWBYDByZp8tz3HWcQG3KqSzzR8tBUERQnqZBzWoA1Ua_aXRUQ@mail.gmail.com>
On Tue, Jun 21, 2016 at 7:08 PM, Florian Rivoal <[email protected]> wrote:
> On Jun 22, 2016, at 07:12, Simon Pieters <[email protected]> wrote:
>> On Tue, 21 Jun 2016 19:22:52 +0200, Tab Atkins Jr. <[email protected]> wrote:
>>
>>> I'd strongly prefer not having the OM be gratuitiously different from
>>> the syntax. That's just confusing for everyone, and makes it more
>>> confusing to work with, not less - how do you add an @else rule to the
>>> document via the OM? Can you just append it to the stylesheet and
>>> magic happens, or do you need to get that final conditional rule,
>>> chase its .else pointers until you hit a null, then set it to your new
>>> rule?
>>
>> Yeah, I suppose it would indeed be confusing.
>
> I don't know. @else isn't an autonomous construct, so I don't feel strongly about supporting the ability to "just append it to the stylesheet". An @else is part of a conditional rule chain, and I don't find it particularly weird to need to walk the chain to be able to append something to it.

It's very confusing when two ways of looking at a document present an
entirely different "shape" to the document, unless the two ways are
*very intentionally* doing different types of things.  This is not the
case here; the literal syntax and the CSSOM purposely present
essentially the same thing in the same way, and so we shouldn't add
any gratuitous differences.  If an @else is a sibling rule of
something in the literal syntax, it should be a sibling rule in the
OM.

~TJ