diff --git a/src/prototype/lang/string.js b/src/prototype/lang/string.js index 1e0277ca4..cd02b3e04 100644 --- a/src/prototype/lang/string.js +++ b/src/prototype/lang/string.js @@ -769,7 +769,7 @@ Object.extend(String.prototype, (function() { * //-> false **/ function include(pattern) { - return this.indexOf(pattern) > -1; + return this.indexOf(pattern) !== -1; } /** @@ -910,7 +910,8 @@ Object.extend(String.prototype, (function() { unfilterJSON: unfilterJSON, isJSON: isJSON, evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON, - include: include, + //ECMA 6 supports contains(), if it exists map include() to contains() + include: String.prototype.contains || include, // Firefox 18+ supports String.prototype.startsWith, String.prototype.endsWith startsWith: String.prototype.startsWith || startsWith, endsWith: String.prototype.endsWith || endsWith,