Javascript function to identify duplicates and ignore duplicates only in a certain thing

This below js code checks for duplicate aliases in html code given in textarea and if the alias is repeated it shows duplicate alias found error I want to ignore and don’t show duplicate error only in this case

`<!--[if mso]>
    <a href="https://www.w3schools.com" alias="test">Visit W3Schools</a> 
<![endif]-->
`
`<a href="https://www.w3schools.com" alias="test">Visit W3Schools</a>
`
It should not display duplicate alias only if it is in 
`<!--[if mso]>
    
<![endif]-->
`

Js code

    const checkAliasInNode = (node) => {
      const alias = node.getAttribute("alias");
      const href = node.getAttribute("href");
      if (href === null) {
    // Handle the case where href is null (or undefined) separately
    console.error("Href attribute is null or undefined for the following node:", node);
    return;
  }
      if (alias === null || alias.trim() === "") {
        missingAliases.push(`<span style="color: red;">Missing alias for link with href = "${href}" </span>`);
      } else if (!/^[a-zA-Z0-9_]+$/.test(alias) || alias.endsWith("-")) {
        invalidAliases.push(`<span style="color: #FF641C;">Invalid alias "${alias}" for link with href = "${href}" </span>`);
      } else if (aliases.has(alias)) {
        duplicateAliases.push(`<span style="color: #FF641C;">Duplicate alias "${alias}" found for link with href = "${href}" </span>`);
      } else {
        aliases.add(alias);
      }
     };

It should not display duplicate alias only in mso it can be excused