improve performance by delaying the loading of print style sheets

Assigned to



9 years ago
8 months ago


(Reporter: asa, Assigned: bzbarsky)



Firefox Tracking Flags

(Not tracked)



We should delay the loading of print style sheets or other media queries that don't apply to the screen medium.
alternate summary:  "Performance: postpone loading of style sheets non-applicable to the current device mode/media"

(from email discussion)

Tantek said: 
  Agreed, we could easily postpone loading of stylesheets with explicit
  media attributes that don't apply to the current device (e.g.
  media="print" style sheet on an interactive device) until after loads
  that may be used to render the current device.

Boris said: 
  This might not be a bad idea; we can handle it similarly to the way we
  handle alternate stylesheets.  Shouldn't be that hard to do that for
  media queries that don't apply to the screen medium. 
  Bug not on file yet, right?

Tantek said: 
  * if a script changes the media attribute of such a style sheet (e.g.
  from "print" to "screen"), expecting that the style sheet is already

Boris said: 
  What do other browsers do here?  If they don't block scripts on
  alternate-media sheets, then there's no problem.    But yes, this is a
  (minor) worry.

Tantek said: 
  if a script attempts to access the Style Sheet object model of such
  style sheet and it hasn't loaded yet.

Boris said: 
  This is a general problem; you can always race setTimeout against
  loading stylesheets, right?  Gecko throws an exception if script tries
  to do this.  We've had very few reports of resulting issues.  I think
  as long as we block onload for the sheet we should be ok, more or
  less.  At least the jquery ready() issues have been somewhat sorted
  out by the fact that it can fire before our normal screen sheets have
  loaded too.
Assignee: nobody → bzbarsky
Priority: -- → P2
Moving to p3 because no activity for at least 1 year(s).
See for more information
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.