diff options
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/dom/document-util.js | 1 | ||||
-rw-r--r-- | ext/js/dom/text-source-element.js | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ext/js/dom/document-util.js b/ext/js/dom/document-util.js index 80081aca..393ef294 100644 --- a/ext/js/dom/document-util.js +++ b/ext/js/dom/document-util.js @@ -36,6 +36,7 @@ class DocumentUtil { switch (element.nodeName.toUpperCase()) { case 'IMG': case 'BUTTON': + case 'SELECT': return new TextSourceElement(element); case 'INPUT': imposterSourceElement = element; 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; |