Last modified: 2013-08-08 04:06:11 UTC
Consider http://kryogenix.org/code/browser/sorttable/. It would be tremendously useful on all sorts of pages . . . but it requires 6 KB of Javascript to be included. Not good. Consider, however, if the code could be added by an admin to a special namespace, say [[Include:Sorttable.js]], and then the text "{{Include:Sorttable.js}}" would add that page's wikitext to the page in question via a <script> in the header? Any page where a sortable table would be used could include that, for great increase and functionality with no needless bandwidth loss. Obviously, only certain specially-designated pages could be included, namely ones in the Include: namespace. The file would presumably be Javascript, but it could be applied to CSS as well if that would be useful to someone.
Now feasible thanks to ParserOutput::$mHeadItems et al.
*** Bug 31958 has been marked as a duplicate of this bug. ***
Yes, Bug 31958 (marked as duplicate) contains some scenarios. The above-mentioned include namespace should be the existing Mediawiki: namespace, but what is still missing is a parserfunction that injects a javascript from Mediawiki-namespace into a specific article page, to support custom functionalities developed by the community according to community needs for specific purposes.