Ensure range default & value types match
This commit is contained in:
parent
ae6e2647a3
commit
7cd4380ee4
|
@ -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));
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user