From 2a527428a2947e738b540c9def2af5143514c1e9 Mon Sep 17 00:00:00 2001 From: "sonarqube-agent[bot]" <210722872+sonarqube-agent[bot]@users.noreply.github.com> Date: Fri, 8 May 2026 09:03:04 +0000 Subject: [PATCH] fix: Address 4 SonarQube issues Fixed issues: - AZxrBYnQc5mXC10on-tv for javascript:S7764 rule - AZxrBYo0c5mXC10on-t4 for javascript:S7741 rule - AZxrBYnAc5mXC10on-tt for javascript:S7773 rule - AZxrBYnAc5mXC10on-tu for javascript:S7773 rule Generated by SonarQube Agent (task: 9717c2b3-d84d-4719-ba6d-45dee5a52dbd) --- src/script/app/_widget-access.js | 4 ++-- src/script/app/app.js | 2 +- src/script/blocs/bloc-o-carte-interactive.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/script/app/_widget-access.js b/src/script/app/_widget-access.js index 7a0da74..40af30c 100644 --- a/src/script/app/_widget-access.js +++ b/src/script/app/_widget-access.js @@ -9,7 +9,7 @@ if (!Array.prototype.includes) { } // 1. Soit o égal à ? Object(cette valeur). - var o = Object(this); + var o = new Object(this); // 2. Soit len égal à ? Length(? Get(o, "length")). var len = o.length >>> 0; @@ -32,7 +32,7 @@ if (!Array.prototype.includes) { var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); function sameValueZero(x, y) { - return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); + return x === y || (typeof x === 'number' && typeof y === 'number' && Number.isNaN(x) && Number.isNaN(y)); } // 7. Répéter tant que k < len diff --git a/src/script/app/app.js b/src/script/app/app.js index 83e9f7e..235042a 100644 --- a/src/script/app/app.js +++ b/src/script/app/app.js @@ -3,7 +3,7 @@ // On donne le focus à la fenêtre du site et non au navigateur // // * * * * * * * * * * * * * * * * * * * * -$(window).focus(); +$(globalThis).focus(); // * * * * * * * * * * * * * * * * * * * * // diff --git a/src/script/blocs/bloc-o-carte-interactive.js b/src/script/blocs/bloc-o-carte-interactive.js index deb0b3b..b9298b5 100644 --- a/src/script/blocs/bloc-o-carte-interactive.js +++ b/src/script/blocs/bloc-o-carte-interactive.js @@ -110,8 +110,8 @@ $(document).ready(function () { if ( typeof drupalSettings !== 'undefined' && - typeof drupalSettings.asip !== 'undefined' && - typeof drupalSettings.asip.map !== 'undefined' ) { + drupalSettings.asip !== undefined && + drupalSettings.asip.map !== undefined ) { regionsData = drupalSettings.asip.map; }