Last modified: 2011-03-04 10:19:21 UTC
Here's one example; let's say i want to set all links pink if i'm on Special:Contributions. Not so easy: .page-Special_Contributions a { color:pink; } But if I go to [[Special:Contributions/Some_user]] and look closely i see that it produces a unique className like ".page-Special_Contributions_Some_user" for each "sub-page", despite them not being sub-pages but rather a short-hand for the "target" parameter cf. /index.php?title=Special:Contributions&target=Some_user is a completely identical page except for the user-name not being part of its body-class. target-specific skinning of special pages *may* have a few weird and niche uses, but i doubt it's what most people would expect or ever want. Looks like the cleanest way is to fulfill the example exercise is to inject css via js? Poor. > if(wgPageName=="Special:Contributions") > appendCSS("a { color:pink; }"); Well i did notice that wgPageName never includes the user-name or anything else after the slash in the url of a "Special:" page. Surely this and the body-class ought, at a minimum, to be mutually consistent...?
I agree that this is a bug, especially given the inconsistency between Special:Contributions/User and Special:Contributions?target=User. On the other hand, I _can_ think of some few legitimate uses for having special page subpages in the class name, like [[Special:Watchlist/edit]], [[Special:UserLogin/signup]] or even [[Special:Contributions/newbies]]. I suppose we could always provide two class names, one with and one without subpages. Alternatively, we could leave the page-Foo classes as they are, and add an extra class for special pages (maybe "special-Contributions"). This would also be a good opportunity to use the canonical instead of the localized name.
Fixed in r81604: special pages now have an extra "special-Whatever" body class based on the canonical special page name without subpages.
> On the other hand, I _can_ think of some few legitimate uses for having > special page subpages in the class name, like [[Special:Watchlist/edit]], > [[Special:UserLogin/signup]] or even [[Special:Contributions/newbies]]. I > suppose we could always provide two class names, one with and one without > subpages. would that apply to pages in namespaces where "real" sub-pages are allowed, i.e. would [[Wikipedia:Arbitration/Requests/Enforcement/Archive71]] get the following body-class names: > page-Wikipedia_Arbitration > page-Wikipedia_Arbitration_Requests > page-Wikipedia_Arbitration_Requests_Enforcement > page-Wikipedia_Arbitration_Requests_Enforcement_Archive71