8000 switchers.js not compatible with Sphinx 6 / requires jQuery · Issue #159 · python/docsbuild-scripts · GitHub
[go: up one dir, main page]

Skip to content

switchers.js not compatible with Sphinx 6 / requires jQuery #159

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

Closed
hugovk opened this issue Jul 13, 2023 · 0 comments · Fixed by #160
Closed

switchers.js not compatible with Sphinx 6 / requires jQuery #159

hugovk opened this issue Jul 13, 2023 · 0 comments · Fixed by #160

Comments

@hugovk
Copy link
Member
hugovk commented Jul 13, 2023
  1. Open https://docs.python.org/3.12/ and check the language and version switchers are shown in the header:

image

  1. Check the footer: "Created using Sphinx 4.5.0."
  2. Open https://docs.python.org/3.13/ and see the switchers are not shown:

image

  1. Check the footer: Created using Sphinx 6.2.0."
  2. Check the browser console:
switchers.js:168 Uncaught ReferenceError: $ is not defined
    at switchers.js:168:3
    at switchers.js:182:3

This is because Sphinx 6 removed jQuery:

#7405: Removed the jQuery and underscore.js JavaScript frameworks.

These frameworks are no longer be automatically injected into themes from Sphinx 6.0. If you develop a theme or extension that uses the jQuery, $, or $u global objects, you need to update your JavaScript to modern standards, or use the mitigation below.

https://www.sphinx-doc.org/en/master/changes.html#release-6-0-0-released-dec-29-2022 has a couple of options on how to re-add jQuery, but it would be better rewrite https://github.com/python/docsbuild-scripts/blob/main/templates/switchers.js to use vanilla JavaScript.

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

Successfully merging a p 33B1 ull request may close this issue.

1 participant
0