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

Refactor: don't depend on underscore.js #116

Merged
merged 1 commit into from
Aug 9, 2022
Merged

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Aug 5, 2022

This uses the DOM API to create the elements
instead of using templates from underscorejs.
The HTML structure is exactly the same.

Would be great to re-structure the HTML of the results in a major version release, a more simple structure and use CSS for spacing instead of br elements.

The only usage of jQuery that is left is for fade in/out animations.

This uses the DOM API to crate the elements
instead of using templates from underscorejs.
The html structure is exactly the same.
@stsewd stsewd requested review from a team and agjohnson August 5, 2022 00:14
Copy link

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Another approach here would be to move the template into an HTML template. There might be a slight benefit to this approach as it could be translated alongside other Sphinx resources, and the search page would be localized to match the documentation locale. I would consider this for future changes to this extension, it doesn't need to compete with this implementation. I'll open an issue


let separator = createDomNode("br", {class: "br-for-hits"});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If more space is needed, wrapping in a <p> is preferable to styling spacing using <br>, which should almost always be avoided. The issue with <br> is that it is difficult to style around. Wrapping each block in <p> should get you similar vertical spacing however.

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 this pull request may close these issues.

2 participants