W3C home > Mailing lists > Public > public-html@w3.org > October 2008

media attribute and nested media restrictions

From: L. David Baron <dbaron@dbaron.org>
Date: Fri, 24 Oct 2008 14:23:46 +0200
To: public-html@w3.org
Message-ID: <20081024122346.GA29081@pickering.dbaron.org>

http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-link-element says:
  # The user agent must apply the external resource to views while
  # their state match the listed media and the other relevant
  # conditions apply, and must not apply them otherwise.
and http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-style-element says:
  # User agents must apply the styles to views while their state
  # match the listed media, and must not apply them otherwise. 

This is somewhat unclear as to how nesting of media restrictions
works, and how linking of the same style sheet multiple times works.
In particular:
 (1) If a style sheet is linked twice, once with a media attribute
 that matches and once with one that does, this seems to require
 that the user agent both apply and not apply the style sheet.  (In
 applies it only through the link that does match.  The order is
 relevant for the cascade, testably so if there are other sheets
 between the links.)

 (2) This seems to imply that the media attribute overrides media
 restrictions inside the style sheets (either linked or in style
 elements).  It should be clear that media restrictions nest, and
 that all of the media restrictions surrounding a path to a rule
 must match the state of the view for that rule to be applied via
 that path.

This is equivalent to http://wiki.csswg.org/spec/css2.1#issue-46
which was resolved in CSS 2.1 via the proposal in
http://lists.w3.org/Archives/Public/www-style/2008Jun/0106.html plus
adding "The import only takes effect if the target medium matches
the media list." to the last paragraph in CSS 2.1 section 6.3.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Friday, 24 October 2008 12:24:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:23 GMT