r9760 - helma-ng/trunk/modules/core

[email protected] Thu, 14 May 2009 17:27:38 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090514152738.157023D0D6@mia>
Author: hannes
Date: 2009-05-14 17:27:37 +0200 (Thu, 14 May 2009)
New Revision: 9760

Modified:
   helma-ng/trunk/modules/core/string.js
Log:
Fix bug in String.prototype.endsWith()

Details at http://dev.helma.org/trac/helma/changeset/9760

Modified: helma-ng/trunk/modules/core/string.js
===================================================================
--- helma-ng/trunk/modules/core/string.js	2009-05-14 15:27:34 UTC (rev 9759)
+++ helma-ng/trunk/modules/core/string.js	2009-05-14 15:27:37 UTC (rev 9760)
@@ -454,7 +454,7 @@
  */
 Object.defineProperty(String.prototype, "endsWith", {
     value: function(str) {
-        return this.lastIndexOf(str) == this.length - str.length;
+        return this.length >= str.length && this.lastIndexOf(str) == this.length - str.length;
     }
 });