Last modified: 2014-08-08 22:11:08 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 T71288, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 69288 - Cloned collapsible contents are no longer collapsible
Cloned collapsible contents are no longer collapsible
Status: NEW
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.24rc
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-08 09:26 UTC by Michael M.
Modified: 2014-08-08 22:11 UTC (History)
3 users (show)

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


Attachments

Description Michael M. 2014-08-08 09:26:26 UTC
To reproduce go to any page with collapsible content, e.g. https://en.wikipedia.org/wiki/Help:Table#Using_class_mw-collapsible
Execute in the console:

$clone = $('#bodyContent').clone();
mw.hook('wikipage.content').fire($clone);
$('#bodyContent').replaceWith($clone);

The collapsible content is now no longer collapsible (but at least sortable tables are still sortable). Note that it doesn't work with the following code, either (and this breaks sortable tables, too: bug 38704):

$clone = $('#bodyContent').clone(true);
$('#bodyContent').replaceWith($clone);

What I'm currently doing (in a script that shows footnotes in a popup and should be able to show collapsible and sortable tables as such) is an additional $clone.find('.mw-collapsible-toggle').remove(); between the first and second line, but this is more a hack than a solution:

$clone = $('#bodyContent').clone();
$clone.find('.mw-collapsible-toggle').remove();
mw.hook('wikipage.content').fire($clone);
$('#bodyContent').replaceWith($clone);

This is probably easily fixable: The cloned handles are recognized as such, but when the user clicks on them the content isn't collapsed/expanded, because they are links. If the pass-through behavior wasn't applied to links with href="#", the cloned contents will probably be collapsible without hacks.
Comment 1 Bartosz Dziewoński 2014-08-08 22:11:08 UTC
Hmm, yeah. The proposed fix looks reasonable to me. This would be a slightly hacky workaround, but it shouldn't cause any problems. Perhaps a better long-term solution would be to make the toggles actual buttons, but we can think about that some other time.

(Nitpick correction: the collapsibility still works, but you need to click on one of the brackets '[]', and not on the link itself.)

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


Navigation
Links