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()) {
|
switch (element.nodeName.toUpperCase()) {
|
||||||
case 'IMG':
|
case 'IMG':
|
||||||
case 'BUTTON':
|
case 'BUTTON':
|
||||||
|
case 'SELECT':
|
||||||
return new TextSourceElement(element);
|
return new TextSourceElement(element);
|
||||||
case 'INPUT':
|
case 'INPUT':
|
||||||
imposterSourceElement = element;
|
imposterSourceElement = element;
|
||||||
|
@ -126,6 +126,13 @@ class TextSourceElement {
|
|||||||
case 'IMG':
|
case 'IMG':
|
||||||
content = element.getAttribute('alt') || '';
|
content = element.getAttribute('alt') || '';
|
||||||
break;
|
break;
|
||||||
|
case 'SELECT':
|
||||||
|
{
|
||||||
|
const {selectedIndex, options} = element;
|
||||||
|
const option = (selectedIndex >= 0 && selectedIndex < options.length ? options[selectedIndex] : null);
|
||||||
|
content = (option !== null ? option.textContent : '');
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
content = `${element.value}`;
|
content = `${element.value}`;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user