Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.value = inputValue;
if (isUserInput) { // input
this.fireEvent(this.EVENT_INPUT);
// Angular two way data binding
this.fireEvent("value-changed");
return;
}
if (isSubmit) { // submit
this.fireEvent(this.EVENT_SUBMIT);
}
// In IE, pressing the ENTER does not fire change
const valueChanged = (this.previousValue !== undefined) && (this.previousValue !== this.value);
if (isIE() && isSubmit && valueChanged) {
this.fireEvent(this.EVENT_CHANGE);
}
}
_handleInput(event) {
if (event.target === this.getInputDOMRef()) {
// stop the native event, as the semantic "input" would be fired.
event.stopImmediatePropagation();
}
/* skip calling change event when an input with a placeholder is focused on IE
- value of the host and the internal input should be differnt in case of actual input
- input is called when a key is pressed => keyup should not be called yet
*/
const skipFiring = (this.getInputDOMRef().value === this.value) && isIE() && !this._keyDown && !!this.placeholder;
!skipFiring && this.fireEventByAction(this.ACTION_USER_INPUT);
this.hasSuggestionItemSelected = false;
if (this.Suggestions) {
this.Suggestions.updateSelectedItemPosition(null);
}
}
_oninput(event) {
const nativeTextarea = this.getInputDomRef();
/* skip calling change event when an textarea with a placeholder is focused on IE
- value of the host and the internal textarea should be different in case of actual input
- input is called when a key is pressed => keyup should not be called yet
*/
const skipFiring = (this.getInputDomRef().value === this.value) && isIE() && !this._keyDown && !!this.placeholder;
if (event.target === nativeTextarea) {
// stop the native event, as the semantic "input" would be fired.
event.stopImmediatePropagation();
}
if (skipFiring) {
return;
}
this.value = nativeTextarea.value;
this.fireEvent("input", {});
// Angular two way data binding
this.fireEvent("value-changed");
}