MCPcopy Create free account
hub / github.com/InverseUI/InverseUI-Recorder / getElementValue

Function getElementValue

util/dom_utils.js:77–96  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

75 * Get element value handling different input types
76 */
77export function getElementValue(element) {
78 if (!element) return '';
79
80 const tagName = element.tagName.toLowerCase();
81
82 if (tagName === 'input' || tagName === 'textarea') {
83 return element.value;
84 } else if (tagName === 'select') {
85 const selectedOption = element.options[element.selectedIndex];
86 return {
87 value: element.value,
88 text: selectedOption ? selectedOption.text : '',
89 selectedIndex: element.selectedIndex
90 };
91 } else if (element.isContentEditable) {
92 return element.textContent;
93 } else {
94 return element.textContent.trim();
95 }
96}
97
98/**
99 * Check if element is interactive (clickable, editable, etc.)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected