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

       Web browser: ---
            Bug ID: 61305
           Summary: Flow: don't load CSS twice
           Product: MediaWiki extensions
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Flow
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: sp...@wikimedia.org
                CC: ebernhard...@wikimedia.org, mpinc...@wikimedia.org,
                    pandiculat...@gmail.com, sp...@wikimedia.org
   Mobile Platform: ---

Flow adds some modules with both addModuleStyles() and addModules(), e.g.
   addModuleStyles( array( 'ext.flow.header' ) );
   addModules( array( 'ext.flow.header' ) );
The first adds the CSS in a <link rel="stylesheet">, the second adds the same
CSS in a JavaScript mw.loader.load() call that appends to a <style> tag in the
document. It's a performance hit to add CSS twice and the duplicated Flow CSS
rules in browsers' CSS inspector make debugging harder.

addModuleStyles() should only be used to load a separate
'flow.<somefeature>.styles' module that only has the LESS and CSS files for the
no-JavaScript version. The LESS files for this could be named
<something>-nojs.less. addModules( 'flow.<somefeature>' ) should only include
LESS and CSS if it's only referenced by the module's JavaScript-generated HTML,
such as a JavaScript dialog with unique CSS classes.

^ BTW performance: you don't need to pass an array if it's just one module.

-- 
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