Bug ID: 61852
           Summary: mw.loader.using() doesn't really wait for CSS to be
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: ResourceLoader
       Web browser: ---
   Mobile Platform: ---

While ResourceLoader seems to correctly wait for JS dependencies to be loaded
before firing using()'s callback, when it adds CSS to the page, all it does is
create <link> elements to the head, not waiting for the CSS content to really
be loaded.

Which means that something waiting for CSS dependencies sees its callback
called too early, when the required CSS hasn't been loaded yet.

Symptoms in code leveraging mw.loader.using() include broken CSS flashing by
(because elements are shown before their styles are applied), or even broken
application logic when JS does size-dependent actions fail due to missing
styles (the elements aren't the size they will be once the styles are applied).

Afaik modern browsers support the onload event on link elements, so that's
probably a solution to explore. If that can't be done, an alternative is to
insert a special CSS rule at the end of each CSS file served indicating that
the CSS has been loaded, and waiting for that style to appear. The latter is
what I'm going to attempt right now as a workaround for MultimediaViewer, which
is broken (particularly in Chrome) at the moment because of this bug.

You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
Wikibugs-l mailing list

Reply via email to