aboutsummaryrefslogtreecommitdiff
path: root/ext/js/dom/text-source-element.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-28 13:26:23 -0500
committerGitHub <noreply@github.com>2021-02-28 13:26:23 -0500
commitfce2c51709852eea9dc14efe937537383e9c418d (patch)
tree4cb5ec9be9e424fd8f31c4a56afc63502c7afa39 /ext/js/dom/text-source-element.js
parentf2d2ba0d25b6276d60001077573e30b60701a2d4 (diff)
Add support for scanning the selected value of <select> elements (#1461)
Diffstat (limited to 'ext/js/dom/text-source-element.js')
-rw-r--r--ext/js/dom/text-source-element.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/js/dom/text-source-element.js b/ext/js/dom/text-source-element.js
index 45186636..1576bd5e 100644
--- a/ext/js/dom/text-source-element.js
+++ b/ext/js/dom/text-source-element.js
@@ -126,6 +126,13 @@ class TextSourceElement {
case 'IMG':
content = element.getAttribute('alt') || '';
break;
+ case 'SELECT':
+ {
+ const {selectedIndex, options} = element;
+ const option = (selectedIndex >= 0 && selectedIndex < options.length ? options[selectedIndex] : null);
+ content = (option !== null ? option.textContent : '');
+ }
+ break;
default:
content = `${element.value}`;
break;