Use String.replaceAll() instead of String.replace() with /g flag (S7781)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -921,7 +921,7 @@ function sliderValueRange(e, direction) {
|
||||
// Update the slider
|
||||
selectArea.value = closestIndexes;
|
||||
// Reset the start/end calendar selection range
|
||||
if (!isDateType) inputValue = Number(e.value.replace(/,/g, ""));
|
||||
if (!isDateType) inputValue = Number(e.value.replaceAll(",", ""));
|
||||
if (direction === "start") {
|
||||
if (isDateType) {
|
||||
endMinDate.value = e;
|
||||
|
||||
@@ -523,7 +523,7 @@ function switchTab(newTab) {
|
||||
function timeLabel(time) {
|
||||
// sonar-qube prevent super-linear runtime due to backtracking; change * to ?
|
||||
//
|
||||
const label = getTimeLabel(time).replace(/\s+/g, " "); // Collapse all consecutive whitespace into a single space
|
||||
const label = getTimeLabel(time).replaceAll(/\s+/g, " "); // Collapse all consecutive whitespace into a single space
|
||||
const result = label.match(/^([\d.]+)\s?([a-zA-Z]+)$/); // add ^ and $ to meet sonar-qube need
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ function onChange(event) {
|
||||
* @param {KeyboardEvent} event - The keyup event.
|
||||
*/
|
||||
function onKeyUp(event) {
|
||||
event.target.value = event.target.value.replace(/\D/g, "");
|
||||
event.target.value = event.target.value.replaceAll(/\D/g, "");
|
||||
if (event.keyCode === 38 || event.keyCode === 40) {
|
||||
actionUpDown(event.target, event.keyCode === 38, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user