Last modified: 2014-02-18 21:30:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T42284, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40284 - The CSS of each gadget is included two times
The CSS of each gadget is included two times
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Gadgets (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
https://test.wikipedia.org/w/index.ph...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-16 16:12 UTC by Helder
Modified: 2014-02-18 21:30 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Helder 2012-09-16 16:12:46 UTC
I noticed that when I enable this gadget
https://test.wikipedia.org/wiki/Special:Gadgets/export/EditTools
and go to
https://test.wikipedia.org/w/index.php?title=TestPage&action=edit&debug=1
the HTML source code of the page contains two copies of
https://test.wikipedia.org/w/index.php?title=MediaWiki:Gadget-EditTools.css&oldid=144099

Indeed, searching for elements containing "ext.gadget.EditTools&only=styles" on Google Chrome 21.0.1180.89 I find:
<link rel="stylesheet" href="//test.wikipedia.org/w/load.php?debug=true&amp;lang=en&amp;modules=ext.gadget.EditTools&amp;only=styles&amp;skin=vector&amp;*">

and

<link type="text/css" rel="stylesheet" href="//test.wikipedia.org/w/load.php?debug=true&amp;lang=en&amp;modules=ext.gadget.EditTools&amp;only=styles&amp;skin=vector&amp;version=20120916T155758Z&amp;*">

The same happens for "ext.gadget.hlist-test&only=styles":

<link rel="stylesheet" href="//test.wikipedia.org/w/load.php?debug=true&amp;lang=en&amp;modules=ext.gadget.hlist-test&amp;only=styles&amp;skin=vector&amp;*">

<link type="text/css" rel="stylesheet" href="//test.wikipedia.org/w/load.php?debug=true&amp;lang=en&amp;modules=ext.gadget.hlist-test&amp;only=styles&amp;skin=vector&amp;version=20120916T155758Z&amp;*">
Comment 1 Roan Kattouw 2012-09-24 17:02:43 UTC
This was also brought up in bug 29693 comment 9, see my response there for an explanation of why this is currently happening.
Comment 2 Krinkle 2012-09-24 17:32:50 UTC
I was going to duplicate with bug 29693. Whatever solution (if any) is considered, it can be applied to Gadgets similarly.

One possible way (though not an option for gadget) is to require that modules be split in a part that contains style for server output and a module with javascript and styling for that.

That's how we do it in core for some of these cases. Note that this split up can not (should not) be automated because some stylesheets are only relevant in a scripted context and visa versa.

The only problem is that we don't have a way to tell gadgets that it should be loaded as a <link> only with only=styles. Effectively adding a new type of module (dynamic bottom, dynamic top, static top), which can't have scripts.
Comment 3 spage 2014-02-18 21:30:16 UTC
This double loading is going to occur with gadgets and the 'mediawiki.ui.button' module. We recommend gadgets explicitly load their required modules; we will probably add addModuleStyles( 'mediawiki.ui.button' ) on all pages so that simple templates like {{Blue button}} work without JavaScript. So the button CSS will be added to a style tag in the DOM by the former and added as a link by the latter.

The fix could be to add a separate mw.loader.loadCSS/usingCSS() function that can check to see if the CSS has already been loaded using addModuleStyles.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links