Re: [cssom] Constructor for MediaList

Le 25/06/2013 18:42, Tab Atkins Jr. a écrit :
> Instead, we can directly address this by allowing the value of a
> custom MQ to be set to a MediaList, with the meaning being that it has
> the same truth value as the contained MQs:
>
> <script>
> document.css.customMedia.set("foo", new MediaList("(foo:bar) and (baz:qux)"));
> </script>
> <style>
> @media "foo" {
>    ...
> }
> </style>

Why is a constructor needed instead of just a string?

document.css.customMedia.set("foo", "(foo:bar) and (baz:qux)");

-- 
Simon Sapin

Received on Wednesday, 26 June 2013 11:22:51 UTC