'media' attribute inconsistencies in HTML4 (was Re: Error in HTML DTD)

From: Matthew Brealey <webmaster@richinstyle.com>
Date: Thu, Nov 16, 2000, 4:57 AM

> http://www.w3.org/TR/html401/types.html#type-media-descriptors:
> 'A case-sensitive match is then made with the set of media types
> defined above.'
>
> but
> http://www.w3.org/TR/html4/present/styles.html#adef-media says that
> media is CI.


 Short version:

Matthew is correct, this is an inconsistency in HTML4.

Another inconsistency in HTML4 is the interpretation of a missing 'media'
attribute on the STYLE or LINK element.

In both cases, a single interpretation (for each inconsistency) was chosen
(correctly IMHO) and propagated into other specifications and
implementations.

HTML4 should be errata'd (www-html-editor@w3.org cc'd) to fix both
inconsistencies to be consistent with what has already been chosen,
additionally specified, and implemented.



 Long version:


I.  'media' attribute case-(in)sensitivity


The only place in HTML4 which says anything about case-sensitive media is in
the prose Matthew quoted.[1]

The attribute list for both the LINK[2] and STYLE[3] elements both refer to
(hyperlink to) the CI (Case Insensitive) interpretation of MEDIA.[4]

 "media = media-descriptors [CI]"

Additionally, CSS2 uses case-insensitive media types [6] (based on the list
from HTML4 in fact).

 "Media type names are case-insensitive."

Now, see Ian Hickson's "CSS Import Test - Test 43" (exotic media) [7],
specifically test 43g on that page which tests specifically for media set to
"Screen" (note initial capital).

Note the results of Ian Hickson's "CSS Import Test" [8], which shows that
current versions of IE and Netscape pass test 43 (which includes test 43g).
I believe the current (4.x) version of Opera also treats media in a
case-insensitive manner.


Conclusion: based upon the consistent preponderance of specifications,
tests, and implementations, the prose in HTML4 which references
case-sensitive media should be fixed.  E.g. the following from [1]:

  "3.  A case-sensitive match is then made with the set of media types
defined above. "

should be changed to:

  "3. A case-insensitive match is then made with the set of media types
defined above. "




II. 'media' attribute default value ('all' or 'screen'?)


Another error in HTML4 regarding media is this:

In the attribute definition for 'media' [4], it says:

 'The default value for this attribute is "screen".'

Which would imply that if there is no media attribute, the value of the
'media' attribute is to be interpreted as 'screen'.

However, In 14.4.1 Media-dependent cascades [5], it says:

 'The "techreport" stylesheet applies to all media.'

That style sheet in the example in the text:

 <LINK rel="stylesheet" href="techreport.css" type="text/css">

lacks a 'media' attribute.  Thus the text is implicitly saying that if there
is no 'media' attribute, the value of the 'media' attribute can be
interpreted as 'all' in direct contradiction with the statement about the
default value.

Additionally, in CSS2, @import without media specified applies to all media
[9]:

 "In the absence of any media types, the import is unconditional. Specifying
'all' for the medium has the same effect. "

Modern browser implementations which actually pay attention to the media
attribute (current versions of IE, Netscape, Opera...) all interpret the
lack of a media attribute on the STYLE element or the LINK element as
applying to all media.


Conclusion:  based upon the consistent preponderance of specifications, and
implementations, the wording in HTML4 which notes the default value for the
media attribute should be fixed.  E.g. the following from [4]:

  'The default value for this attribute is "screen".'

should be changed to:

  'The default value for this attribute is "all".'


Thanks,

Tantek


[1]
 http://www.w3.org/TR/html401/types.html#type-media-descriptors

[2]
 http://www.w3.org/TR/html401/struct/links.html#h-12.3

[3]
 http://www.w3.org/TR/html401/present/styles.html#h-14.2.3

[4]
 http://www.w3.org/TR/html401/present/styles.html#adef-media

[5]
 http://www.w3.org/TR/html401/present/styles.html#media-cascades

[6]
 http://www.w3.org/TR/REC-CSS2/media.html#media-types

[7]
 http://www.bath.ac.uk/%7Epy8ieh/internet/importtest/main/exoticmedia.html

[8]
 http://www.bath.ac.uk/%7Epy8ieh/cgi/listresults.pl?ID=ImportTest&mainPivote
d=on&mainSortV=Tests&mainSortH=Score&mainMinTests=4

[9]
 http://www.w3.org/TR/REC-CSS2/cascade.html#at-import


----------------------------------------------------------------------------
Ok, now I'm supposed to be say...           http://www.microsoft.com/mac/ie/

Received on Monday, 20 November 2000 13:05:30 UTC