prototype: String.prototype.endsWith should not fail on multiple occurrences. Closes #7416.
This commit is contained in:
parent
225bf0e6ec
commit
74596ac289
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* String.prototype.endsWith should not fail on multiple occurrences. Closes #7416. [Christophe Porteneuve]
|
||||
|
||||
* Add Form.Methods.request as a convenience method for serializing and submitting a form via Ajax.Request to the URL in the form's action attribute. [sam]
|
||||
|
||||
Options passed to request() are intelligently merged with the underlying Ajax.Request options:
|
||||
|
|
|
@ -151,7 +151,7 @@ Object.extend(String.prototype, {
|
|||
},
|
||||
|
||||
endsWith: function(pattern){
|
||||
return this.indexOf(pattern) == (this.length - pattern.length);
|
||||
return this.lastIndexOf(pattern) == (this.length - pattern.length);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -343,6 +343,7 @@
|
|||
assert('hello world'.endsWith(' world'));
|
||||
assert(!'hello world'.endsWith('planet'));
|
||||
assert(!''.endsWith('planet'));
|
||||
assert('hello world world'.endsWith(' world'));
|
||||
}},
|
||||
|
||||
testSucc: function() {with(this) {
|
||||
|
|
Loading…
Reference in New Issue