Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec-char-escape and & #1382

Open
erosman opened this issue Nov 12, 2023 · 1 comment
Open

spec-char-escape and & #1382

erosman opened this issue Nov 12, 2023 · 1 comment
Labels
bug Functionality that does not work as intended/expected help wanted We are looking for community help

Comments

@erosman
Copy link

erosman commented Nov 12, 2023

Describe the bug

Ampersand is acceptable in HTML text

To Reproduce

HTMLHint generates an error:

Special characters must be escaped : [ & ]. (spec-char-escape)

W3C Markup Validation Service no longer finds any issues with the uncoded &.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Title & More</title>
  </head>
  <body>
    <p>Drag & Drop</p>
  </body>
</html>

Expected behavior

No error

Desktop (please complete the following information):

@coliff coliff added bug Functionality that does not work as intended/expected help wanted We are looking for community help labels Nov 12, 2023
@erosman
Copy link
Author

erosman commented Nov 27, 2023

// TODO: improve use-cases for &
const reSpecChar = /([<>])|( \& )/g

( \& ) is the cause of this issue, as it looks for space-&-space.

Therefore, the following won't look for &

      // TODO: improve use-cases for &
      const reSpecChar = /[<>]/g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality that does not work as intended/expected help wanted We are looking for community help
Projects
None yet
2 participants