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

Remove dependency on jQuery #7405

Closed
septatrix opened this issue Mar 31, 2020 · 21 comments
Closed

Remove dependency on jQuery #7405

septatrix opened this issue Mar 31, 2020 · 21 comments
Labels
Milestone

Comments

@septatrix
Copy link
Contributor

Most things we use jQuery for can now easily be done using vanilla JS even in IE11.

Removing jQuery therefore does not impact browser coverage significantly and instead leads to a smaller website to serve. As this is be a breaking change I would propose to discuss about implementing this for the 4.x release next year.

If the consensus is to go ahead with removing jQuery I would volunteer for this.

@septatrix septatrix added the type:enhancement enhance or introduce a new feature label Mar 31, 2020
@tk0miya tk0miya added this to the 4.0.0 milestone Apr 3, 2020
@tk0miya
Copy link
Member

tk0miya commented Apr 3, 2020

+0: I don't have a strong opinion for your proposal.

@TimKam Any comments?

@TimKam
Copy link
Member

TimKam commented Apr 3, 2020

I like the idea and was actually contemplating it, but we need to make sure we don't introduce bugs on the way, so it will require some effort. Happy to get some help.

@mgeier
Copy link
Contributor

mgeier commented Mar 6, 2021

What about a configuration setting that allows to select whether jQuery should be loaded or not?

If the default value is to use jQuery, this wouldn't be a breaking change, but if people want a smaller website, they could opt out.

@tk0miya
Copy link
Member

tk0miya commented Mar 6, 2021

Not to load jQuery simply causes errors in our JS. It seems the full-text search becomes not working. I think it's broken switch. So we need to refactor our JS before adding such a configuration.

@TimKam
Copy link
Member

TimKam commented Mar 6, 2021

Still, it could be a starting point to first use a flag, if we are concerned that there could be issues with legacy browsers (most likely, there will be issues with very old browsers, the only question is whether these browsers are relevant at all).

@tk0miya
Copy link
Member

tk0miya commented Mar 6, 2021

I got the following errors if I removed the jQuery loading tag. And search form vanished. Is this really a good starting point?

doctools.js:35 Uncaught ReferenceError: jQuery is not defined
    at doctools.js:35
index.html:71 Uncaught ReferenceError: $ is not defined
    at index.html:71

@TimKam
Copy link
Member

TimKam commented Mar 6, 2021

Sorry, I meant: after an initial refactoring, it could be a good starting point to have flag for a while, so that people can switch back easily. But even there, I am not sure. Looking at the basic template, there are not too many occurrences.

@tk0miya
Copy link
Member

tk0miya commented Mar 6, 2021

Okay, I understand. I agree the option is worthy if we'll complete the refactoring. So it would be nice if somebody posts a pull request to lessen the usage of jQuery from our JS.

@septatrix
Copy link
Contributor Author

I have not looked too much into the scope but I can see myself doing this. However I could start at the end of this month at the earliest.

@pradyunsg
Copy link
Contributor

So it would be nice if somebody posts a pull request to lessen the usage of jQuery from our JS.

I'm interested in having Sphinx 5 drop the bundled jQuery entirely, so I'll pick this up! Feel free to move this to the 5.0.0 milestone! :)

/cc @humitos so that RTD can prepare for a no-jquery future.

@astrojuanlu
Copy link
Contributor

cc @nienn @agjohnson

@pradyunsg
Copy link
Contributor

pradyunsg commented Nov 16, 2021

There's an open question here: What are the browsers that Sphinx should target to support?

@pradyunsg
Copy link
Contributor

I think I'd like to exclude IE 11 from the support matrix, since it'll allow using ES6.

Given that IE 11 is not supported even in first-party Microsoft 365 applications and that the end of life of IE 11 is June 15, 2022 -- I think this is acceptable!

@tk0miya
Copy link
Member

tk0miya commented Nov 16, 2021

I'd like to hear the opinion of RTD team. They would know the ratio of the browsers in the real world.

The EOL of IE11 is good news to us. Sphinx-5.0 will be out in the Apr, 2022. So we can consider the drop of it. It's reasonable and acceptable for me.

@agjohnson
Copy link
Contributor

For some data here: all versions of internet explorer represent 0.23% of our traffic in a given month, and 85% of internet explorer traffic is version 11. In real numbers this is about 55k pageviews out of 28M per month. It's hard to pinpoint a number where we aren't concerned about a browser, but this does seem safe. Browsers that can't load JS will still at least be readable by users, just not very usable.

The sphinx_rtd_theme has effectively dropped IE11, and will be fully dropped next release. We could aim for a similar deprecation time frame and drop around or before Apr 2022

@septatrix
Copy link
Contributor Author

Additionally downstream theme developers could always re-add jQuery on their own if they need it.

@tk0miya
Copy link
Member

tk0miya commented Nov 17, 2021

Okay, let's go forward. It's time to say farewell to IE11.

@pradyunsg
Copy link
Contributor

Hurray! I'll spend some time on this over the next few weeks.

@pradyunsg
Copy link
Contributor

pradyunsg commented Nov 20, 2021

Browsers that can't load JS will still at least be readable by users, just not very usable.

The three main things that wouldn't work are:

  • JS-based translations.
  • Search term highlighting on all pages.
  • Search, on the search page.

As long as the site is rendered with gettext at build-time, most sites will be pretty usable (minus search) and also degrade somewhat gracefully.

@pradyunsg
Copy link
Contributor

I've started working on this, and filed #9874 -- which is very much a WIP, but feedback is welcome.

I'll clean up the commit messages before marking it ready for review. :)

@TimKam
Copy link
Member

TimKam commented Jan 30, 2022

Closing this one. #10070 remains open until the actual dependencies are removed.

@TimKam TimKam closed this as completed Jan 30, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2022
@AA-Turner AA-Turner modified the milestones: some future version, 6.0.0 Jul 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants