UNPKG

@yookue/ts-lang-utils

Version:

Common lang utilities for typescript

13 lines 569 B
export function getValueDescriptor(element) { if (!element) { return undefined; } if (element instanceof HTMLInputElement) { return Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value'); } else if (element instanceof HTMLSelectElement) { return Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value'); } else if (element instanceof HTMLTextAreaElement) { return Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value'); } return Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value'); }