W3C home > Mailing lists > Public > www-style@w3.org > April 2010

Re: [css3-mediaqueries][cssom] Empty media queries in stylesheets and the DOM

From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Date: Fri, 30 Apr 2010 13:04:41 +0200
Message-ID: <4BDAB949.7080102@disruptive-innovations.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: Sylvain Galineau <sylvaing@microsoft.com>, www-style list <www-style@w3.org>
Le 28/04/10 19:50, L. David Baron a écrit :

> As Daniel pointed out in today's telecon, we also need to specify
> whether that restriction for @media is syntactic (something enforced
> only at parse time) or dynamic (something that's also enforced after
> mutation of the media list is mutated via the object model).  I
> believe Daniel said that it should be syntactic (a parse time check
> only), which happens to be what I implemented.  I also agree that
> this is the right thing (presuming we want this restriction on
> @media at all); I would not want to have to implement dynamic
> enforcement of this restriction, while enforcing it syntactically is
> a one line code change (see the patch in the above bug).  However,
> it would mean that an @media rule all of whose media had been
> removed dynamically would have to be serialized as @media all, a
> slight quirk.


I pondered the possibility to say a CSSMediaRule with an empty
media list applies to no medium at all...
But on the OM side, we need to be able to take a given CSSMediaRule and
copy an existing media list inside that CSSMediaRule. Suppose that
media list is empty - meaning "all" for the source object - the
CSSMediaRule must then deal with an empty media list as meaning "all".
In summary, that means we need the following:

   a. a CSSMediaRule with an empty media list applies to all media.
   b. an empty media list attached to a CSSMediaRules is serialized as
      "all" to preserve validity of the serialization


Then we need to check if existing web pages use @media {} at all
in a way we're not aware of (a hack). If the change is harmless
and we allow @media {}, then we have nothing to do on the OM side,


We have to deal with all of this because both @media syntax and OM
were designed at a time Media Queries did not exist. Option 1 above
is workable and induces no change on the syntactic side, but has a
light side-effect on the OM one: parsing of the serialization of a
CSSMediaRule with an empty media list will NOT be equal (from an OM
point of view) to the original CSSMediaRule.
Option 2 above is hyper-simple if workable. My gut feeling is that we
should aim at option 2. With my editor's implementor hat on, I don't
like the side-effect of option 1 I just highlighted above. Such things
should not happen. I could live with it though; does not mean I find
it a beautiful solution.

Received on Friday, 30 April 2010 11:05:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:34 UTC