https://bugzilla.wikimedia.org/show_bug.cgi?id=61852

            Bug ID: 61852
           Summary: mw.loader.using() doesn't really wait for CSS to be
                    loaded
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: ResourceLoader
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: gdu...@wikimedia.org
                CC: krinklem...@gmail.com, roan.katt...@gmail.com,
                    tpars...@wikimedia.org
       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
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to