Ian Hickson wrote:
>
> While writing some tests for the StyleSheet interface, I came across a
> seeming inconsistency:
>
> Why are 'href', 'type', and 'title' readonly, while the media attribute
> can be changed through its MediaList interface?
>
> If someone could shed some light on this I would be very thankful...
The obscur reason was that the user should not be able to modify the linking
element through the stylesheet itself. Even if this reason is obvious for
the href attribute, this is not especially the case for type and title. In
case, media should be harmonized with type and title. But, if the media list
is readonly, the MediaList interface becomes almost useless.
> If one changes the media list of a StyleSheet interface that is associated
> with a particular node in the DOM, e.g. a <link> element, should the
> changes be reflected back in this node?
I would say yes but we might need to reconsider the readonly issue before going
further.
> e.g. assuming the element has:
>
> <link rel="stylesheet" href="foo.css">
>
> ...and I do:
>
> document.styleSheets.item(0).media.appendMedium('braille');
>
> ...should the element then become:
>
> <link rel="stylesheet" href="foo.css" media="braille">
>
> ...?
>
> How about if the stylesheet was linked using an @import, or an HTTP 'Link'
> header? Should those be changed too?
I would say yes too. If you change the media attribute in the CSS import rule,
you'll expect the media list to be updated, won't you?
Philippe