MCPcopy
hub / github.com/Bistutu/FluentRead / isInputElement

Function isInputElement

entrypoints/content.ts:743–759  ·  view source on GitHub ↗

* 检查元素是否为输入元素

(element: HTMLElement)

Source from the content-addressed store, hash-verified

741 * 检查元素是否为输入元素
742 */
743function isInputElement(element: HTMLElement): boolean {
744 if (!element) return false;
745
746 const tagName = element.tagName.toLowerCase();
747 const isInput = tagName === 'input';
748 const isTextarea = tagName === 'textarea';
749 const isContentEditable = element.contentEditable === 'true';
750
751 // 对于input元素,还需要检查type属性
752 if (isInput) {
753 const inputType = (element as HTMLInputElement).type.toLowerCase();
754 const textInputTypes = ['text', 'search', 'url', 'email', 'password'];
755 return textInputTypes.includes(inputType);
756 }
757
758 return isTextarea || isContentEditable;
759}
760
761/**
762 * 获取输入框中的文本

Callers 1

setupInputBoxTranslationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected