Add root title class to <body>
authorMarc A. Pelletier <marc@uberbox.org>
Sun, 3 Apr 2016 07:46:06 +0000 (10:46 +0300)
committerCoren <marc@uberbox.org>
Wed, 20 Apr 2016 02:59:56 +0000 (22:59 -0400)
This adds a class to the body node of output pages in the form:

rootpage-X

Where X is the root title of the page.

This provides for the use cases in the linked tasks, and allows the
numerous existing cases of expensive css selectors using class*='page-X'
that are otherwise needed to apply a style to a page and or its subpages.

Bug: T123156
Bug: T17075
Change-Id: Ib16e380d97bd7bb55c5b5044a084fefbd039d599

includes/skins/Skin.php

index dbc84c0..5b50cd8 100644 (file)
@@ -387,8 +387,9 @@ abstract class Skin extends ContextSource {
                }
 
                $name = Sanitizer::escapeClass( 'page-' . $title->getPrefixedText() );
+               $root = Sanitizer::escapeClass( 'rootpage-' . $title->getRootTitle()->getPrefixedText() );
 
-               return "$numeric $type $name";
+               return "$numeric $type $name $root";
        }
 
        /**