You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
329 B

8 years ago
  1. /**
  2. * Escape special characters in the given string of html.
  3. *
  4. * @param {String} html
  5. * @return {String}
  6. * @api private
  7. */
  8. module.exports = function(html) {
  9. return String(html)
  10. .replace(/&/g, '&')
  11. .replace(/"/g, '"')
  12. .replace(/'/g, ''')
  13. .replace(/</g, '&lt;')
  14. .replace(/>/g, '&gt;');
  15. }