From fc8dae73625db2f100922b3eae4726367a97558e Mon Sep 17 00:00:00 2001 From: Giulio Starace Date: Mon, 18 Nov 2019 04:15:24 -0300 Subject: [PATCH] fix issue with highlighted text --- GPTrueOrFalse/src/content/content.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPTrueOrFalse/src/content/content.js b/GPTrueOrFalse/src/content/content.js index ee289ae..f47f517 100644 --- a/GPTrueOrFalse/src/content/content.js +++ b/GPTrueOrFalse/src/content/content.js @@ -23,9 +23,9 @@ function evaluateSelection() { // get the selected text let selection = window.getSelection(); // determine which node is at the bottom of the selection and assign it to the element - if (selection.anchorOffset && !selection.focusOffset) { + if (selection.anchorOffset) { element = selection.anchorNode.parentNode; - } else if (selection.focusOffset && !selection.anchorOffset) { + } else if (selection.focusOffset) { element = selection.focusNode.parentNode; } // parse the selected text