[docs] [issue26246] Code output toggle button uses removed jQuery method

Liang Bo Wang report at bugs.python.org
Sun Jan 31 05:05:17 EST 2016


New submission from Liang Bo Wang:

The code output toggle button (the `>>>` button on the top right) has been disappeared and not functional on the current online documentation (both 3.4+ and 2.7). 


For example, see any doc page that has interpreter outputs:

    https://docs.python.org/3/tutorial/introduction.html#numbers
    https://docs.python.org/3.5/tutorial/introduction.html#numbers
    https://docs.python.org/3.4/tutorial/introduction.html#numbers
    https://docs.python.org/2/tutorial/introduction.html#numbers


These toggle buttons are created dynamically using jQuery by the script at Doc/tools/static/copybutton.js. However, the method .toggle() it used for click event handling has been deprecated since jQuery 1.8 and removed since jQuery 1.9.

    https://api.jquery.com/toggle-event/


Current Python documentation ships with jQuery v1.11.1 and it has a new .toggle() method with totally different behavior, which controls animation and hide the element. Therefore those buttons are invisible and has no effect.

    https://api.jquery.com/toggle/


To achieve the old behavior, one now needs to create this toggle event on one's own. The most popular way to store the toggle state is by jQuery's .data() data storage.

A patch is attached to make the button functional again.

----------
assignee: docs at python
components: Documentation
files: copybutton_js.patch
keywords: patch
messages: 259279
nosy: Liang Bo Wang, docs at python, eric.araujo, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: Code output toggle button uses removed jQuery method
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41764/copybutton_js.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26246>
_______________________________________


More information about the docs mailing list