sphinx-tabs
sphinx-tabs copied to clipboard
sphinx-tabs does not work with DataTables/jQuery inside
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 https://github.com/executablebooks/sphinx-tabs/blob/0632f4bfb4df799c4c66612051ce5f1aabf9269b/sphinx_tabs/static/tabs.js#L137-L145
Reproduce the bug
Add a table from the examples into a tab
.. tabs::
.. tab:: All-Time Contributions
.. raw:: html
:file: contributors_stats.html
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
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
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! :tada:
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