From f0b03cc17d72c34de1ffee2a012078b3496a342f Mon Sep 17 00:00:00 2001 From: Belem Zhang Date: Wed, 19 Jun 2024 12:38:47 +0800 Subject: [PATCH 1/2] [NNotepad] Fix #253 e.target.close is not a function error --- nnotepad/js/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nnotepad/js/index.js b/nnotepad/js/index.js index 6f1c8685..b96e5ca1 100644 --- a/nnotepad/js/index.js +++ b/nnotepad/js/index.js @@ -71,6 +71,10 @@ document.addEventListener('DOMContentLoaded', async (e) => { ); $$('dialog').forEach((dialog) => { dialog.addEventListener('click', (e) => { + if (e.target && + (e.target.id === 'srcClose' || e.target.id === 'helpClose')) { + return; + } const rect = e.target.getBoundingClientRect(); if ( e.clientY < rect.top || From 30877b1b1ccb616fe2f07070d05b2a7a3d7ecefa Mon Sep 17 00:00:00 2001 From: Belem Zhang Date: Wed, 19 Jun 2024 13:48:29 +0800 Subject: [PATCH 2/2] check dialog for e.target directly --- nnotepad/js/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nnotepad/js/index.js b/nnotepad/js/index.js index b96e5ca1..798653aa 100644 --- a/nnotepad/js/index.js +++ b/nnotepad/js/index.js @@ -71,10 +71,7 @@ document.addEventListener('DOMContentLoaded', async (e) => { ); $$('dialog').forEach((dialog) => { dialog.addEventListener('click', (e) => { - if (e.target && - (e.target.id === 'srcClose' || e.target.id === 'helpClose')) { - return; - } + if (e.target !== dialog) return; const rect = e.target.getBoundingClientRect(); if ( e.clientY < rect.top ||