Last modified: 2008-08-10 09:22:57 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 T17052, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15052 - Skins should add their name as a class in <body>
Skins should add their name as a class in <body>
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-05 22:53 UTC by Jon Harald Søby
Modified: 2008-08-10 09:22 UTC (History)
5 users (show)

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


Attachments

Description Jon Harald Søby 2008-08-05 22:53:43 UTC
Each skin should add its name (or ID or whatever) as a class in <body>. The reason I request this is that it would enable gadgets to change the CSS of a page in different ways depending on what skin is used.

For an example, turn on the "Dynamic menus" gadget on Meta; it is only intended for Modern, and will look awful in other skins like Monobook or Standard. With a CSS identifier for each skin, it could be adapted (or disabled) for other skins than Modern, and avoid making a mess.
Comment 1 Chad H. 2008-08-06 00:57:57 UTC
Any particular reason the skin name provided with the javascript vars can't be used?
Comment 2 Jack Phoenix 2008-08-06 01:09:20 UTC
Fixed in r38675.
Comment 3 Daniel Friesen 2008-08-06 02:29:38 UTC
Reverted in r38677:
The commit was clearly not thought through and is poorly implemented.

It simply tacked the skin name onto the end of the body's class attribute. The idea of a skin className inside of the body tag has been discussed many times before. But one common agreement is that the class should be prefixed with 'skin-' as we prefix all the other stuff.

Additionally this code likely was not tested. It made use of "get_class( $this );" to find the 'skin name', this is a poor and unreliable method of doing this. Not only should the case of the skin name to output (lowercase id like 'monobook', or normal form 'MonoBook'), it's highly likely for the class to NOT be the name of the skin.

----
Discussion on this 'feature' is something that should be continued. Though, before WONTFIX'ing it as has been done in the past Splarka does note that this will be useful when [[MediaWiki:Print.css]] and [[Special:MyPage/print.css]] are implemented. That'll allow skin-specific print rules without a separate file for each one.

Personally, I'd also note that it would allow for minor skin-specific tweaks in Common.css
ie: A large body of code such as Titleicons code is inside of Common.css, and some minor location tweaks can be made for different skins, without resorting to separating the Titleicons code into multiple css files. (Actually, it would also allow for customizing something to work in multiple similar skins at the same time without duplicating the code)
Comment 4 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-08-06 15:00:24 UTC
I'd like to see some more concrete use-cases for this before spamming another class onto the body element.
Comment 5 Brion Vibber 2008-08-06 19:34:00 UTC
Use cases include user common CSS, site common CSS, browser user stylesheet / greasemonkey CSS, extension CSS, gadget CSS, etc which might want to tweak for specific skins.

I would recommend the classname being skin-{$skinname}. SkinTemplate provides a 'skinname' thingy already... though it should probably be whatever name is used in the prefs, $wgValidSkins, $wgDefaultSkin bla bla that we grabbed globally.
Comment 6 SQL 2008-08-10 09:22:57 UTC
Fixed again in r39058 .

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


Navigation
Links