Last modified: 2013-10-31 01:04:29 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 T28799, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26799 - Restrict mediawiki.util to general JavaScript utilities only (branch off to mediawiki.page)
Restrict mediawiki.util to general JavaScript utilities only (branch off to m...
Status: NEW
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Krinkle
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-19 03:25 UTC by Michael Dale
Modified: 2013-10-31 01:04 UTC (History)
5 users (show)

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


Attachments

Description Michael Dale 2011-01-19 03:25:08 UTC
mediawiki.util should separate methods that do mediaWiki "page" stuff vs classes that do "utility" stuff.

This way extensions that have alternate page structure or "skinless" entry points like "iframe video player", "facebook connect" type popup or any "popup windows" don't have to load DOM targets and convience functions for stuff that does not exist.  ( not to mention stand alone usage ;) 

Some culprits include:  "mw.util.updateTooltipAccessKeys",  "mw.util.$content", "mw.util.addPortletLink" "updateTooltipAccessKeys" etc.

I suggest moving base skin helpers into mediawiki.skin and keeping mediawiki.util for utility functions.
Comment 1 Michael Dale 2011-01-28 16:53:25 UTC
Also I suggest moving the mediaWiki.user class outside of the core mediawiki.js since A) Its dependent on jquery.cookie ( which could be expressed as a normal resource dependency ) and B) its not needed for stand alone usage of the resource loader.
Comment 2 Krinkle 2011-01-28 17:14:05 UTC
I'll create a mediaWiki.page or mediaWiki.wiki module soon and migrate the appropiate scripts to it.
Comment 3 Krinkle 2011-02-14 00:21:51 UTC
On second thought, rather than moving mediaWiki-specific things out of mediaWiki.util, I think it is good where it is (they are "mediaWiki" utilities)

Instead anything not mediawiki-specific could go into a the convience functions plugin where $.trim, $.escapeRE etc. are
So mw.util.getParamValue would become $.getParamValue, and rawurlencode to $.rawurlencode.

And $content, addPortletLink etc. would stay in mw.util
Comment 4 Michael Dale 2011-02-14 05:57:09 UTC
These are functions that target mediawiki page interfaces. For example, How would these function be useful for an embed-player iframe page that just outputs a video player? ( In that context there are no portlet links etc. )... but the video player might want to escape some attributes or convert a title key into a link. 

I think its worthwhile to distinguish utility functions related to the main mediawiki page interface vs utility function that could be useful across multiple mediawiki js use contexts / interfaces.
Comment 5 Krinkle 2011-02-19 00:35:49 UTC
(In reply to comment #4)
> These are functions that target mediawiki page interfaces. For example, How
> would these function be useful for an embed-player iframe page that just
> outputs a video player? ( In that context there are no portlet links etc. )...
I don't think that matters. That embed player would end up on a MediaWiki page eventually, right ? So it could need addPortletLink. Or when it builds an iframe, perhaps it builds a mediawiki-like list of links somewhere (ie. #p-myvideoplayer), then you can use this function for it  as well.

Generally not needing a function in certain scenario is harmless. There are many classes, functions and variables in MediaWiki core not needed on most pages but they're initialised anyway since there's no way of knowing what is 'needed'. I know one case doesn't always justify another, but take GlobalFunctions for example. Many useful functions there but not needed on every page in every scenario.


> but the video player might want to escape some attributes or convert a title
> key into a link. 
Escaping attributes is done in mw.html though.


> I think its worthwhile to distinguish utility functions related to the main
> mediawiki page interface vs utility function that could be useful across
> multiple mediawiki js use contexts / interfaces.

I think it makes more sense to be distinguishing between "within MediaWiki" and "re-using outside MediaWiki" scenarios rather than "on MediaWiki articles" and "MediaWiki extensions iframe".

The functions are there, if you don't need them there that's fine. They're cached anyway. If you'd seperate modules like that, that means different resource requests and less cache use.

Then the client needs to re-download all functions because in that iframe the resourceloader link would not request "mediawiki.articleutils" module or whatever.


(bug 27149 refers to this bug)
Comment 6 Krinkle 2011-06-22 21:27:42 UTC
Moved out part of them in r90605.

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


Navigation
Links