Skip to content

Commit

Permalink
🐛 fix(header): correctif erreur itérable null [DS-3747] (#893)
Browse files Browse the repository at this point in the history
- corrige l'issue #890, la valeur null renvoyée par la fonction match est remplacée par un array vide pour permettre son itération
  • Loading branch information
lab9fr authored Mar 1, 2024
1 parent 4edc673 commit bbacb81
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/component/header/script/header/header-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class HeaderLinks extends api.core.Instance {
const toolsHtml = this.toolsLinks.innerHTML.replace(/ +/g, ' ');
const menuHtml = this.menuLinks.innerHTML.replace(/ +/g, ' ');
// Pour éviter de dupliquer des id, on ajoute un suffixe aux id et aria-controls duppliqués.
let toolsHtmlIdList = toolsHtml.match(/id="(.*?)"/gm);
if (toolsHtmlIdList) {
// on a besoin d'échapper les backslash dans la chaine de caractère
// eslint-disable-next-line no-useless-escape
toolsHtmlIdList = toolsHtmlIdList.map(element => element.replace('id=\"', '').replace('\"', ''));
}
let toolsHtmlIdList = toolsHtml.match(/id="(.*?)"/gm) || [];

// on a besoin d'échapper les backslash dans la chaine de caractère
// eslint-disable-next-line no-useless-escape
toolsHtmlIdList = toolsHtmlIdList.map(element => element.replace('id=\"', '').replace('\"', ''));

const toolsHtmlAriaControlList = toolsHtml.match(/aria-controls="(.*?)"/gm);
let toolsHtmlDuplicateId = toolsHtml.replace(/id="(.*?)"/gm, 'id="$1' + copySuffix + '"');
if (toolsHtmlAriaControlList) {
Expand Down

0 comments on commit bbacb81

Please sign in to comment.