Skip to content

Commit b8945bd

Browse files
authored
support firefox esr (#836)
* closes #828 * prettier * javascript manual check * fix all the tests
1 parent 3203e61 commit b8945bd

File tree

40 files changed

+42
-40
lines changed

40 files changed

+42
-40
lines changed

src/client/toc.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ const toc = document.querySelector<HTMLElement>("#observablehq-toc");
22
if (toc) {
33
const highlight = toc.appendChild(document.createElement("div"));
44
highlight.classList.add("observablehq-secondary-link-highlight");
5-
const headings = Array.from(document.querySelectorAll<HTMLElement>(toc.dataset.selector!)).reverse();
5+
const headings = Array.from(document.querySelectorAll<HTMLElement>(toc.dataset.selector!))
6+
.reverse()
7+
.filter((e) => e.querySelector("a.observablehq-header-anchor"));
68
const links = toc.querySelectorAll<HTMLElement>(".observablehq-secondary-link");
79
const relink = (): HTMLElement | undefined => {
810
for (const link of links) {

src/render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ interface Header {
151151
href: string;
152152
}
153153

154-
const tocSelector = ["h1:not(:first-of-type)", "h2:not(h1 + h2):has(a.observablehq-header-anchor)"];
154+
const tocSelector = ["h1:not(:first-of-type)", "h2:not(h1 + h2)"];
155155

156156
function findHeaders(parseResult: ParseResult): Header[] {
157157
return Array.from(parseHTML(parseResult.html).document.querySelectorAll(tocSelector.join(", ")))

test/output/build/404/404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import "./_observablehq/client.js";
2525

2626
</script>
27-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
27+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
2828
<nav>
2929
</nav>
3030
</aside>

test/output/build/archives/tar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</ol>
7171
</nav>
7272
<script>{/* redacted init script */}</script>
73-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
73+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
7474
<nav>
7575
</nav>
7676
</aside>

test/output/build/archives/zip.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</ol>
5757
</nav>
5858
<script>{/* redacted init script */}</script>
59-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
59+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
6060
<nav>
6161
</nav>
6262
</aside>

test/output/build/config/closed/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</ol>
3636
</nav>
3737
<script>{/* redacted init script */}</script>
38-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
38+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
3939
<nav>
4040
</nav>
4141
</aside>

test/output/build/config/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</ol>
3636
</nav>
3737
<script>{/* redacted init script */}</script>
38-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
38+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
3939
<nav>
4040
</nav>
4141
</aside>

test/output/build/config/one.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</ol>
3636
</nav>
3737
<script>{/* redacted init script */}</script>
38-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
38+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
3939
<nav>
4040
</nav>
4141
</aside>

test/output/build/config/sub/two.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</ol>
3636
</nav>
3737
<script>{/* redacted init script */}</script>
38-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
38+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
3939
<nav>
4040
</nav>
4141
</aside>

test/output/build/config/toc-override.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</ol>
3636
</nav>
3737
<script>{/* redacted init script */}</script>
38-
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2):has(a.observablehq-header-anchor)">
38+
<aside id="observablehq-toc" data-selector="#observablehq-main h1:not(:first-of-type), #observablehq-main h2:not(h1 + h2)">
3939
<nav>
4040
<div>dollar&amp;pound</div>
4141
<ol>

0 commit comments

Comments
 (0)