1

I was looking at this answer (copied below)

What I didn't understand is why is / escaped?


There is also the solution from mustache.js

https://github.com/janl/mustache.js/blob/master/mustache.js#L82

 var entityMap = {
    "&": "&",
    "<": "&lt;",
    ">": "&gt;",
    '"': '&quot;',
    "'": '&#39;',
    "/": '&#x2F;'
  };

  function escapeHtml(string) {
    return String(string).replace(/[&<>"'\/]/g, function (s) {
      return entityMap[s];
    });
  }
Community
  • 1
  • 1
BruteCode
  • 1,083
  • 6
  • 16
  • 21

1 Answers1

-1

There is no need at all to escape the / in HTML.

Allie
  • 824
  • 1
  • 9
  • 14