Skip to content

Commit

Permalink
IntersectionObserver: support for domain object headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Sep 13, 2022
1 parent eccfb71 commit c63a0e7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/insipid_sphinx_theme/insipid/static/insipid-sidebar.js_t
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,17 @@
if (id) {
id = id.slice(1);
section = document.getElementById(decodeURI(id));
// Detect API doc headers:
let single_definition_term = (
section.nodeName == 'DT' &&
section.nextElementSibling.nodeName == 'DD' &&
!section.nextElementSibling.nextElementSibling &&
section.parentElement.nodeName == 'DL');
if (single_definition_term) {
// The <dl> contains only a single <dt> + <dd>,
// therefore we can observe the whole <dl>.
section = section.parentElement;
}
} else {
// NB: The first section has no hash, so we don't know its ID:
section = document.querySelector('div.body .section, div.body section');
Expand Down

0 comments on commit c63a0e7

Please sign in to comment.