Description of problem
In T350515 we had an UBN because the mediawiki.diff.styles were loaded on a page which wasn't a diff page (by FlaggedRevisions in this case). While that bug is easily fixed (and will be patched), it would be helpful to have some clearer guidance around which core ResourceModules modules are considered libraries (reusable) and which are not.
To take further examples:
- the name mediawiki.special implies that will only ever be loaded on special pages
- The name mediawiki.action.styles implies that it will only ever be loaded on ?action pages
For these there is no mention in the ResourceModule definition or any comment blocks inside the file so I am not sure what we would do if we encountered a patch trying to load either on these on diff pages in code review for example.
This may be a separate problem, but in the case of the diff page, there is no way to distinguish a diff page from an article page in CSS as there is no class on the body tag that distinguishes it ( action-view class is present on both diff and article pages) which makes diff-specific styling troublesome.
Timeline
There is no specific timeline for this, however having some clarity would likely lead to less problems of this nature on the long run.
Questions to answer
- Should these files be documented explaining where they are expected to run? The module mediawiki.action.view.filepage for example has a comment saying "File description page"
- Should the frontend stable policy have guidance around use of CSS. For example I wonder if @stable to use would be helpful for stylesheets that we expect to be reused.
- Should we have a convention for module names for distinguishing reusable code and page specific code?
- What is the recommended way for a skin to style a diff page differently from an article? (E.g. Should there be separate modules that it can apply a skinStyle to, or should there be class names on the BODY tag for styling of the diff page?