-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Unescape search result page title and set via textContent
#9965
base: master
Are you sure you want to change the base?
Unescape search result page title and set via textContent
#9965
Conversation
textContent
textContent
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9965 +/- ##
==========================================
+ Coverage 16.06% 17.11% +1.05%
==========================================
Files 90 89 -1
Lines 4769 4755 -14
Branches 832 831 -1
==========================================
+ Hits 766 814 +48
+ Misses 3480 3431 -49
+ Partials 523 510 -13 ☔ View full report in Codecov by Sentry. |
@@ -78,7 +80,7 @@ export function initSearchFacets(facetsElem) { | |||
facetsElem.replaceWith(newFacetsElem) | |||
hydrateFacets() | |||
|
|||
document.title = data.title | |||
setTitle(data.title) |
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.
Can we avoid html-escaping the title entirely on the python side, where data
is created? Then we can do document.title = data.title
, and avoid the lodash dependency.
@@ -88,6 +90,10 @@ export function initSearchFacets(facetsElem) { | |||
} | |||
} | |||
|
|||
function setTitle(title) { | |||
const titleElem = document.querySelector('title') |
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 modifying document.title
is more idiomatic for change the title; was there a reason you switch to querySelector
?
Closes #9787
Unescapes the search result title, then updates the title via the
title
element'stextContent
property.Technical
Testing
Screenshot
Stakeholders