Modernize and fix website build tooling deps and utilize JS type checking (#3348)

* Modernize and fix website build tooling deps and utilize JS type checking

* Upgrade to the latest Node.js
This commit is contained in:
Keavon Chambers
2025-11-06 16:30:35 -08:00
committed by GitHub
parent 96d73a8570
commit 6b315c3b68
18 changed files with 2036 additions and 981 deletions

View File

@@ -1,8 +1,12 @@
window.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("section p").forEach((paragraph) => {
const /** @type {[Text, NodeList][]} */ mutationQueue = [];
// Recursively traverse the DOM tree and modify the text nodes
const recursivelyAddWbr = (node) => {
const recursivelyAddWbr = (/** @type {ChildNode} **/ node) => {
if (node.nodeType === Node.TEXT_NODE) {
if (!(node instanceof Text)) return;
const newNodes = node.textContent.split("/");
for (let i = 0; i < newNodes.length - 1; i++) {
newNodes[i] += "/";
@@ -17,12 +21,11 @@ window.addEventListener("DOMContentLoaded", () => {
node.childNodes.forEach(recursivelyAddWbr);
}
};
// Perform the recursive traversal and replace the text nodes
const mutationQueue = [];
// Perform the recursive traversal
recursivelyAddWbr(paragraph);
mutationQueue.forEach(([node, newNodes]) => {
node.replaceWith(...newNodes);
});
// Replace the text nodes
mutationQueue.forEach(([node, newNodes]) => node.replaceWith(...newNodes));
});
});