Last modified: 2010-05-15 15:48:27 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 T11134, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9134 - sorttable.js fails to init for sortable table
sorttable.js fails to init for sortable table
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
  Show dependency treegraph
Reported: 2007-02-28 19:56 UTC by Alan Harder
Modified: 2010-05-15 15:48 UTC (History)
0 users

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


Description Alan Harder 2007-02-28 19:56:35 UTC
I see a couple other bug reports/feature requests about sortable tables, so
clearly it works for some people.. however, on we got errors
about undefined variables (at least with firefox2).  For some reason,
sorttable.js couldn't see any vars/funcs from outside when document.write was
used in wikibits.js to include sorttable.js.  I changed this to use DOM to
include the script and this was fixed.  Then sorttable.js uses hookEvent to
initialize.. but the file isn't included until another hook event is being
processed.. seems like this is too late to register a new hook event.  I changed
this to just call the init function.  Seems to work now.

Patch below (revision 941 is our own local svn, you can ignore that.. it's
mediawiki 1.9.3).

Index: skins/common/wikibits.js
--- skins/common/wikibits.js    (revision 941)
+++ skins/common/wikibits.js    (working copy)
@@ -853,7 +853,9 @@

 function sortableTables() {
        if (getElementsByClassName(document, "table", "sortable").length != 0) {
-               document.write('<script type="text/javascript"
+// Use XHTML to include js.. with document.write sorttable.js doesn't see
vars/funcs from outside
+//             document.write('<script type="text/javascript"
+var e = document.createElement('script');

Index: skins/common/sorttable.js
--- skins/common/sorttable.js   (revision 941)
+++ skins/common/sorttable.js   (working copy)
@@ -19,7 +19,10 @@
 var alternate_row_colors = true;

-hookEvent( "load", sortables_init);
+//This js file is included from an onload handler, adding a handler now won't
get it invoked.
+//hookEvent( "load", sortables_init);
+//Just call the function:

 var thead = false;
Comment 1 Alan Harder 2007-02-28 20:47:06 UTC
Oops, just looked at current svn and see this is obsolete.. table sorting stuff
is now all in wikibits.js.  Closing.

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