Page MenuHomePhabricator

jquery.tablesorter's data-sort-type feature not working for wikitext tables on WMF
Closed, ResolvedPublic

Description

The WMF 1.18 deploys don't seem to allow the data-sort-type attribute which affects the functionality of the table sorter (making it all but useless)

I think this might be a simple setting, but not sure, could also be something that is not deployed to 1.18wmf1


Version: 1.18.x
Severity: enhancement

Details

Reference
bz31527

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:58 PM
bzimport set Reference to bz31527.

data-* not working because wiki's were not switched to html5 as we once planned. This makes the tablesorter code problematic, because the mixed content mode of the new table sorter is much less resilient than the one of the old table sorter.

Both 1.18wmf1 or 1.18.0 of MediaWiki's version of jquery.tablesorter module supports the data-sort-type attribute. This works on third-party wikis as well as on [[mw:]].

However for tables generated from wikitext, MediaWiki (as usually, and independant from the tablesorter script) strips data-* attributes on wikis that still have wgHtml5 set to false (i.e. 99% of wmf wikis).

mediawiki.org is one of few wikis that does have wgHtml5 set to true, and the new data-sort-type attribute functionality works fine there.

The old tablesorter script wasn't very flexible in sorting, it did everything with detection and was less strict in cases were there was mixed types of content. This also caused several bugs.

The new tablesorter script has fewer bugs in sorting, afiak still allows and supports mixed content and. And as a new feature, it can be forced a certain type with the data-sort-type attribute. This latter feature does not work for tables generated from wikitext – if wgHtml5 is false.

Rephrasing bug, adding dependency on bug 27478 and including in title that's about tables from wikitext (to which the stripping of attributes applies). I think it does work for extensions outputting attributes directlty (I remember some CentralAuth-related SpecialPage being sortable)

There is a class-based metadata format the tablesorter could use which is compatible with HTML 4 (though the data-* options are also compatible if you don't mind your document not being 100% valid): class="foo {sort-type:'number'} bar"

Tablesorter uses the jquery.metadata plugin for that though, which is not present.

  • Bug 39055 has been marked as a duplicate of this bug. ***