W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [cssom] Constructor for MediaList

From: Simon Sapin <simon.sapin@exyr.org>
Date: Wed, 26 Jun 2013 12:22:23 +0100
Message-ID: <51CACEEF.7070606@exyr.org>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Simon Pieters <simonp@opera.com>, Glenn Adams <glenn@skynav.com>, "www-style@w3.org" <www-style@w3.org>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 26 June 2013 11:22:51 UTC