assets/js/dropdownExpander.mjs in hematite-0.1.9 vs assets/js/dropdownExpander.mjs in hematite-0.1.10
- old
+ new
@@ -55,14 +55,17 @@
if (hash == null || isInvalid) {
return;
}
let targetElem = document.querySelector(hash);
- let currentElem = targetElem;
- expandContainingDropdowns(targetElem);
-
- targetElem.focus();
+ if (targetElem) {
+ expandContainingDropdowns(targetElem);
+ targetElem.focus();
+ }
+ else {
+ console.warn(`Hash`, hash, `does not correspond to an element.`);
+ }
};
doExpansion(location.href);
addEventListener("hashchange", ({ newURL }) => {
doExpansion(newURL);