-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Embedded js: remove some dependency from jquery #9508
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
Conversation
@@ -275,23 +296,27 @@ function attach_elastic_search_query_mkdocs(data) { | |||
var results = data.results || []; | |||
|
|||
if (results.length) { | |||
var searchResults = $('#mkdocs-search-results'); | |||
searchResults.empty(); | |||
let searchResults = document.getElementById('mkdocs-search-results'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also just kill the mkdocs integration, isn't currently being used (only on my test project).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 👍🏼 on removing things we are not using 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this is something that we instead address with generic version of our search integration. I'm 👍 in both directions, if we aren't using the code it shouldn't hurt to keep it around either, but also happy to see unused code disappeared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove it, and work towards shipping our livesearch as a generic JS library. The less code we have to maintain the better. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good! It's hard to verify without a proper test suite, but this is something to keep on our radar.
@@ -275,23 +296,27 @@ function attach_elastic_search_query_mkdocs(data) { | |||
var results = data.results || []; | |||
|
|||
if (results.length) { | |||
var searchResults = $('#mkdocs-search-results'); | |||
searchResults.empty(); | |||
let searchResults = document.getElementById('mkdocs-search-results'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this is something that we instead address with generic version of our search integration. I'm 👍 in both directions, if we aren't using the code it shouldn't hurt to keep it around either, but also happy to see unused code disappeared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the previous comments, I think this is good to ship. @agjohnson if you want to give it another look, go ahead, but it seems like you already reviewed it and it's 👍 with the review updates.
Also agree that we need to QA this pretty heavily, given the lack of testing 🙃
@@ -30,21 +30,6 @@ function injectFooter(data) { | |||
} | |||
|
|||
|
|||
function setupBookmarkCSRFToken() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, old school 🙃
@@ -275,23 +296,27 @@ function attach_elastic_search_query_mkdocs(data) { | |||
var results = data.results || []; | |||
|
|||
if (results.length) { | |||
var searchResults = $('#mkdocs-search-results'); | |||
searchResults.empty(); | |||
let searchResults = document.getElementById('mkdocs-search-results'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove it, and work towards shipping our livesearch as a generic JS library. The less code we have to maintain the better. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good!
This needs readthedocs/common#155.
Basically replacing ajax calls with the fetch API, and using the DOM API for the manipulation of elements.
Note: we need to create a rule on cloudflare to not cache the analytics endpoint,
we were previously using a hack for this (passing a random query arg). In the future, we should set this at the view level (no-cache). Already did this for .org and .com.