Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
christophfroehlich opened this issue Jan 2, 2024 · 2 comments
Open

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

christophfroehlich opened this issue Jan 2, 2024 · 2 comments

Comments

@christophfroehlich
Copy link

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

Copy link

welcome bot commented Jan 2, 2024

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@foster999
Copy link
Collaborator

Thanks for raising the issue. I'm afraid I don't understand jQuery well enough to work out what's wrong here - I remember these lines being necessary for our js to work with both commonJS and jQuery, but I don't know how they would need to be changed to avoid the errors here

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

No branches or pull requests

2 participants