Skip to content

Commit

Permalink
Refactor SliderWebcomponent: Directly invoke _handleInputChange in at…
Browse files Browse the repository at this point in the history
…tribute change handlers

- Removed the need to dispatch 'blur' events in attribute change handlers for `valueMin` and `valueMax`.
- Directly call `_handleInputChange` method in `_valueMinAttributeChanged` and `_valueMaxAttributeChanged`.
- Implemented type casting to properly handle the event target.
- Retained suppression of attribute change events to prevent infinite loops.
  • Loading branch information
7evenk committed Jun 23, 2024
1 parent 77c8221 commit d617b51
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/slider/SliderWebcomponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,12 @@ export class SliderWebcomponent extends BaseCustomWebComponentConstructorAppend

private _valueMinAttributeChanged() {
if (!this._ready) return;
this._numberInputs[0].value = this.valueMin.toString();
this._numberInputs[0].dispatchEvent(new Event('blur', { bubbles: true }));
this._handleInputChange({ target: this._numberInputs[0] } as unknown as Event);
}

private _valueMaxAttributeChanged() {
if (!this._ready) return;
this._numberInputs[1].value = this.valueMax.toString();
this._numberInputs[1].dispatchEvent(new Event('blur', { bubbles: true }));
this._handleInputChange({ target: this._numberInputs[1] } as unknown as Event);
}

private _minAttributeChanged() {
Expand Down

0 comments on commit d617b51

Please sign in to comment.