Add support for scanning the selected value of <select> elements (#1461)
This commit is contained in:
parent
f2d2ba0d25
commit
fce2c51709
@ -36,6 +36,7 @@ class DocumentUtil {
|
||||
switch (element.nodeName.toUpperCase()) {
|
||||
case 'IMG':
|
||||
case 'BUTTON':
|
||||
case 'SELECT':
|
||||
return new TextSourceElement(element);
|
||||
case 'INPUT':
|
||||
imposterSourceElement = element;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user