forked from external-repos/squoosh
Fix .disabled property reflection for range-input (only attribute worked previously)
This commit is contained in:
@@ -3,8 +3,8 @@ import './styles.css';
|
||||
|
||||
const RETARGETED_EVENTS = ['focus', 'blur'];
|
||||
const UPDATE_EVENTS = ['input', 'change'];
|
||||
const REFLECTED_PROPERTIES = ['name', 'min', 'max', 'step', 'value', 'disabled'];
|
||||
const REFLECTED_ATTRIBUTES = ['name', 'min', 'max', 'step', 'value', 'disabled'];
|
||||
const REFLECTED_PROPERTIES = ['name', 'min', 'max', 'step', 'value'];
|
||||
const REFLECTED_ATTRIBUTES = ['name', 'min', 'max', 'step', 'value'];
|
||||
|
||||
class RangeInputElement extends HTMLElement {
|
||||
private _input = document.createElement('input');
|
||||
@@ -37,6 +37,18 @@ class RangeInputElement extends HTMLElement {
|
||||
this.setAttribute('label-precision', precision);
|
||||
}
|
||||
|
||||
get disabled(): boolean {
|
||||
return this.hasAttribute('disabled');
|
||||
}
|
||||
|
||||
set disabled(disabled: boolean) {
|
||||
if (disabled) {
|
||||
this.setAttribute('disabled', '');
|
||||
} else {
|
||||
this.removeAttribute('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
if (this._input.parentNode !== this) {
|
||||
this.appendChild(this._input);
|
||||
|
||||
Reference in New Issue
Block a user