Merge pull request #6500 from chrootsu/lodash-escape

lodash: signatures of the method _.escape changed
This commit is contained in:
Masahiro Wakame
2015-11-02 22:24:50 +09:00
2 changed files with 33 additions and 2 deletions
+14 -2
View File
@@ -3853,8 +3853,20 @@ module TestEndsWith {
}
// _.escape
result = <string>_.escape('fred, barney, & pebbles');
result = <string>_('fred, barney, & pebbles').escape();
module TestEscape {
{
let result: string;
result = _.escape('fred, barney, & pebbles');
result = _('fred, barney, & pebbles').escape();
}
{
let result: _.LoDashExplicitWrapper<string>;
result = _('fred, barney, & pebbles').chain().escape();
}
}
// _.escapeRegExp
module TestEscapeRegExp {
+19
View File
@@ -9247,6 +9247,18 @@ declare module _ {
interface LoDashStatic {
/**
* Converts the characters "&", "<", ">", '"', "'", and "`", in string to their corresponding HTML entities.
*
* Note: No other characters are escaped. To escape additional characters use a third-party library like he.
*
* Though the ">" character is escaped for symmetry, characters like ">" and "/" dont need escaping in HTML
* and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynenss
* article (under "semi-related fun fact") for more details.
*
* Backticks are escaped because in Internet Explorer < 9, they can break out of attribute values or HTML
* comments. See #59, #102, #108, and #133 of the HTML5 Security Cheatsheet for more details.
*
* When working with HTML you should always quote attribute values to reduce XSS vectors.
*
* @param string The string to escape.
* @return Returns the escaped string.
*/
@@ -9260,6 +9272,13 @@ declare module _ {
escape(): string;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.escape
*/
escape(): LoDashExplicitWrapper<string>;
}
// _.escapeRegExp
interface LoDashStatic {
/**