https://bugzilla.wikimedia.org/show_bug.cgi?id=69288

            Bug ID: 69288
           Summary: Cloned collapsible contents are no longer collapsible
           Product: MediaWiki
           Version: 1.24-git
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: JavaScript
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
       Web browser: ---
   Mobile Platform: ---

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to