From ce31edc80327d4141d5a46b6f07ef33c5113c1ec Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sun, 18 Sep 2022 02:22:52 +0900 Subject: [PATCH] Fix handling of max and min values in function outputs --- .../@node-red/nodes/core/function/10-function.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.html b/packages/node_modules/@node-red/nodes/core/function/10-function.html index 345a77aab..43f8c7b39 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/core/function/10-function.html @@ -454,9 +454,10 @@ min: 0, max: 500, change: function(event, ui) { - var value = this.value; - if (!value.match(/^\d+$/)) { value = 1; } - else if (value < this.min) { value = this.min; } + var value = parseInt(this.value); + value = isNaN(value) ? 1 : value; + value = Math.max(value, parseInt($(this).attr("aria-valuemin"))); + value = Math.min(value, parseInt($(this).attr("aria-valuemax"))); if (value !== this.value) { $(this).spinner("value", value); } } });