From: John Benediktsson Date: Sun, 25 Sep 2022 20:56:32 +0000 (-0700) Subject: help.html: add null check X-Git-Tag: 0.99~1067 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=116a149a258626bc44c052ec7ff10620568c51a0 help.html: add null check --- diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index ce4c206eac..fd258fe2d6 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -97,11 +97,13 @@ M: pathname url-of document.addEventListener('keydown', function (event) { if (event.code == 'Slash') { let input = document.getElementById('search'); - if (input !== document.activeElement) { - event.preventDefault(); - setTimeout(function() { - input.focus().select() - }, 0); + if (input != null) { + if input !== document.activeElement) { + event.preventDefault(); + setTimeout(function() { + input.focus().select() + }, 0); + } } } }); diff --git a/extra/webapps/help/search.js b/extra/webapps/help/search.js index db99569fc4..7ad98c8160 100644 --- a/extra/webapps/help/search.js +++ b/extra/webapps/help/search.js @@ -8,11 +8,13 @@ window.onload = function() { document.addEventListener('keydown', function (event) { if (event.code == 'Slash') { let input = document.getElementById('search'); - if (input !== document.activeElement) { - event.preventDefault(); - setTimeout(function() { - input.focus().select() - }, 0); + if (input != null) { + if (input !== document.activeElement) { + event.preventDefault(); + setTimeout(function() { + input.focus().select() + }, 0); + } } } });