Skip to content

sphinx-tabs does not work with DataTables/jQuery inside #189

Description

@christophfroehlich

Describe the bug

When I add a table with DataTables/jQuery scripts inside a tab, then the javascript is broken.

Uncaught SyntaxError: missing } after function body jquery.js:2:65253note: { opened at line 2, column 278jquery.js:2:278

Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:8081/_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c:12
_sphinx_javascript_frameworks_compat.js:12:1
Uncaught ReferenceError: module is not defined
    jQuery 2
jquery.dataTables.js:38:3
jQuery.Deferred exception: e is not a function enable@http://localhost:8081/_static/js/theme.js:1:1246
@http://localhost:8081/doc/acknowledgements/acknowledgements.html:12658:37
e@https://code.jquery.com/jquery-3.6.0.min.js:2:30038
Deferred/then/l/</t<@https://code.jquery.com/jquery-3.6.0.min.js:2:30340
 undefined jquery-3.6.0.min.js:2:31593
Uncaught TypeError: e is not a function
    enable http://localhost:8081/_static/js/theme.js:1
    <anonymous> http://localhost:8081/doc/acknowledgements/acknowledgements.html:12658
    jQuery 2
        e
        t
theme.js:1:1246

Uncommenting these few lines make all work again

if (typeof exports === 'undefined') {
exports = {};
}
exports.keyTabs = keyTabs;
exports.changeTabs = changeTabs;
exports.selectTab = selectTab;
exports.deselectTabList = deselectTabList;
exports.selectNamedTabs = selectNamedTabs;

Reproduce the bug

Add a table from the examples into a tab

.. tabs::

  .. tab:: All-Time Contributions

    .. raw:: html
      :file: contributors_stats.html

test_table.zip

List your environment

sphinx-copybutton 0.5.2
sphinx-multiversion 0.2.4
sphinx-rtd-theme 2.0.0
sphinx-tabs 3.4.1
sphinxcontrib-applehelp 1.0.7
sphinxcontrib-devhelp 1.0.5
sphinxcontrib-htmlhelp 2.0.4
sphinxcontrib-jquery 4.1
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.6
sphinxcontrib-serializinghtml 1.1.9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions