Ensure range default & value types match

This commit is contained in:
Rob Garrison 2018-09-09 07:37:25 -05:00
parent ae6e2647a3
commit 7cd4380ee4
2 changed files with 5 additions and 4 deletions

View File

@ -224,7 +224,7 @@ var usercss = (() => {
state.errorPrefix = '';
// [default, start, end, step, units] (start, end, step & units are optional)
if (Array.isArray(state.value) && state.value.length) {
result.default = state.value.shift();
result.default = parseFloat(state.value.shift());
const nonDigit = /[^\d.+-]/;
// label may be placed anywhere after default value
const labelIndex = state.value.findIndex(item => nonDigit.test(item));

View File

@ -314,12 +314,13 @@ function configDialog(style) {
}
function updateVarOnChange() {
this.va.value = this.type !== 'checkbox' ? this.value : this.checked ? '1' : '0';
if (this.type === 'number') {
this.value = this.va.value = clampValue(this.value, this.va.range);
}
if (this.type === 'range') {
} else if (this.type === 'range') {
$('.current-value', this.closest('.config-range')).textContent = this.va.value + (this.va.units || '');
this.va.value = parseFloat(this.value);
} else {
this.va.value = this.type !== 'checkbox' ? this.value : this.checked ? '1' : '0';
}
}