@@ -148,6 +149,7 @@ Unchecking this is not recommended, and this option only exists for exceptional
+
diff --git a/static/dom.mts b/static/dom.mts
index a4bf983..e879ec8 100644
--- a/static/dom.mts
+++ b/static/dom.mts
@@ -1,6 +1,13 @@
// I would've LOVED to use generics for this but unfortunately that's not possible.
// Type safety, but at what cost... >~< thanks TypeScript
+export function findAnchorOrFail(on: Element, selector: string): HTMLAnchorElement {
+ const element = on.querySelector(selector);
+ if (!(element instanceof HTMLAnchorElement))
+ throw new Error(`${selector} isn't an a`);
+ return element;
+}
+
export function findDivOrFail(on: Element, selector: string): HTMLDivElement {
const element = on.querySelector(selector);
if (!(element instanceof HTMLDivElement))