Re: [whatwg] attribute media on script element

2008-12-28 Thread Charles McCathieNevile

On Sat, 15 Nov 2008 08:18:25 +1100, Ian Hickson i...@hixie.ch wrote:


On Fri, 14 Nov 2008, Filippo Levizzani wrote:


Would it be possible to have media attribute in the SCRIPT element?
Addmitted vaues would be the same of STYLE element (all, screen, print,
handheld ...)


This doesn't really work because media queries are supposed to change
dynamically. The real solution here is a combination of XBL2 and a new  
API in the CSSOM-View draft (window.media).


Hi Ian,

I can see the value in this (but then, I also see the value in media types  
in styling - something it seems some browser makers are not really  
interested in), and I agree with David's concern that it can have some  
pretty costly implications.


Can you explain why XBL2 is part of the solution here? It seems you have  
something in mind that I don't understand yet.


thanks

Chaals

--
Charles McCathieNevile  Opera Software, Standards Group
je parle français -- hablo español -- jeg lærer norsk
http://my.opera.com/chaals   Try Opera: http://www.opera.com


Re: [whatwg] attribute media on script element

2008-12-28 Thread Ian Hickson
On Mon, 29 Dec 2008, Charles McCathieNevile wrote:
 On Sat, 15 Nov 2008 08:18:25 +1100, Ian Hickson i...@hixie.ch wrote:
  On Fri, 14 Nov 2008, Filippo Levizzani wrote:
   
   Would it be possible to have media attribute in the SCRIPT 
   element? Addmitted vaues would be the same of STYLE element (all, 
   screen, print, handheld ...)
  
  This doesn't really work because media queries are supposed to change 
  dynamically. The real solution here is a combination of XBL2 and a new 
  API in the CSSOM-View draft (window.media).
 
 I can see the value in this (but then, I also see the value in media 
 types in styling - something it seems some browser makers are not really 
 interested in), and I agree with David's concern that it can have some 
 pretty costly implications.

I don't really understand what you mean here. How are browser vendors not 
interested in media types in styling? What has costly implications? What 
implications?


 Can you explain why XBL2 is part of the solution here? It seems you have 
 something in mind that I don't understand yet.

Media-specific scripting is usually needed for media-specific presentation 
or widgets. XBL2 is a way to define widgets, and it can be bound in a 
media-specific way. Thus for instance one could create a set of widgets 
for different window widths, and they would dynamically be swapped in as 
the user changed the window size.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


[whatwg] attribute media on script element

2008-11-14 Thread Filippo Levizzani
Hi,
I don't know if the question has already been posted...

Would it be possible to have media attribute in the SCRIPT element?
Addmitted vaues would be the same of STYLE element (all, screen, print,
handheld ...)

Personally, I'd really love this feature.

Thank you

Kind regards
Filippo

--

Filippo Levizzani
filippo (dot) levizzani (at) gmail (dot) com


[whatwg] attribute media on script element

2008-11-14 Thread Filippo Levizzani
Hi,

Would it be possible to have media attribute in the SCRIPT element?

Addmitted vaues would be the same of STYLE element (all, screen, print,
handheld ...)

Thank you

Kind regards
Filippo


Re: [whatwg] attribute media on script element

2008-11-14 Thread L. David Baron
On Friday 2008-11-14 11:37 +0100, Filippo Levizzani wrote:
 Would it be possible to have media attribute in the SCRIPT element?
 
 Addmitted vaues would be the same of STYLE element (all, screen, print,
 handheld ...)

I'm not quite sure how this would work, since there are two things
that seem incompatible:

 * scripts are executed during parsing / content model construction

 * whether a media attribute is true can change over time

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?

-David

-- 
L. David Baron http://dbaron.org/
Mozilla Corporation   http://www.mozilla.com/


Re: [whatwg] attribute media on script element

2008-11-14 Thread L. David Baron
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
differently.

-David

-- 
L. David Baron http://dbaron.org/
Mozilla Corporation   http://www.mozilla.com/


Re: [whatwg] attribute media on script element

2008-11-14 Thread Ian Hickson
On Fri, 14 Nov 2008, Filippo Levizzani wrote:
 
 Would it be possible to have media attribute in the SCRIPT element? 
 Addmitted vaues would be the same of STYLE element (all, screen, print, 
 handheld ...)

This doesn't really work because media queries are supposed to change 
dynamically. The real solution here is a combination of XBL2 and a new API 
in the CSSOM-View draft (window.media).

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'