Add comment to _.escape.

Former-commit-id: bee148c238552d3cdb6bba3a3511f3d0c5484850
This commit is contained in:
John-David Dalton
2012-05-15 02:16:50 -04:00
parent 793332beb8
commit 628ad0fcb2

View File

@@ -2675,6 +2675,9 @@
* // => "Curly, Larry & Moe"
*/
function escape(string) {
// the `>` character doesn't require escaping in HTML and has no special
// meaning unless it's part of an open tag
// http://mathiasbynens.be/notes/ambiguous-ampersands (semi-related fun fact)
return (string + '')
.replace(/&/g, '&')
.replace(/</g, '&lt;')