From a79f95b305626bcaecfd7da5e5246745fd3811b0 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Sat, 20 Oct 2018 06:51:30 -0500 Subject: [PATCH] Fix (#195) * Fix .disabled property reflection for range-input (only attribute worked previously) * Revert "Fix .disabled property reflection for range-input (only attribute worked previously)" This reverts commit f5964635b2c7fc38e5baa817c0b16436286e56d7. * Fix reflection * Use hasAttribute() --- src/custom-els/RangeInput/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/custom-els/RangeInput/index.ts b/src/custom-els/RangeInput/index.ts index fbfd7624..d6c103e6 100644 --- a/src/custom-els/RangeInput/index.ts +++ b/src/custom-els/RangeInput/index.ts @@ -80,10 +80,12 @@ class RangeInputElement extends HTMLElement { private _reflectAttributes() { this._ignoreChange = true; - for (const attributeName in REFLECTED_ATTRIBUTES) { - const attributeValue = this._input.getAttribute(attributeName); - if (attributeValue === null) continue; - this.setAttribute(attributeName, attributeValue); + for (const attributeName of REFLECTED_ATTRIBUTES) { + if (this._input.hasAttribute(attributeName)) { + this.setAttribute(attributeName, this._input.getAttribute(attributeName)!); + } else { + this.removeAttribute(attributeName); + } } this._ignoreChange = false; }