W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2008

[whatwg] attribute "media" on "script" element

From: L. David Baron <dbaron@dbaron.org>
Date: Fri, 14 Nov 2008 10:24:47 -0800
Message-ID: <20081114182447.GA20114@pickering.dbaron.org>
On Friday 2008-11-14 18:53 +0100, Filippo Levizzani wrote:
> >  * whether a media attribute is true can change over time
> but the same applies to style element , I guess

Yes, but styles can be applied and unapplied easily.

> > This seems to imply that we'd have to go un-execute a script, or
> > that we'd have to execute later something that was skipped earlier,
> > even when that no longer makes sense.
> >
> >
> > What was the actual use case you were trying to solve with this
> > attribute?
> For instance, I'd like to call SWFObject function (to replace html content
> with flash) only if media=screen.
> Other times there are js funcions that have no sense if a given style sheet
> has not been applied to the page.

Would an API that you call from script that allows you to determine
if a given media query matches the default view be sufficient for
your needs?  That seems like it could be more useful than an
attribute that simply prevents scripts from executing, and it avoids
introducing similar-looking attributes that actually behave very


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Friday, 14 November 2008 10:24:47 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:07 UTC