The implementation expects an input element, but an additional guard is in place to only accept DOM elements. The intention was to reject other values such as strings which were common with the previous jQuery implementation.
*/
constructor(element: HTMLInputElement, options: SearchInputOptions) {
this.element = element;
- if (!(this.element instanceof HTMLInputElement)) {
+ if (!(this.element instanceof HTMLElement)) {
throw new TypeError("Expected a valid DOM element.");
} else if (this.element.nodeName !== "INPUT" || (this.element.type !== "search" && this.element.type !== "text")) {
throw new Error('Expected an input[type="text"].');
this.request = undefined;
this.timerDelay = undefined;
this.element = element;
- if (!(this.element instanceof HTMLInputElement)) {
+ if (!(this.element instanceof HTMLElement)) {
throw new TypeError("Expected a valid DOM element.");
}
else if (this.element.nodeName !== "INPUT" || (this.element.type !== "search" && this.element.type !== "text")) {