prototype: Make sure Enumerable#include doesnt do type comparision. [Mislav Marohnić]
This commit is contained in:
parent
1a0f6b3f02
commit
194fda0b6d
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Make sure Enumerable#include doesn't do type comparision. [Mislav Marohnić]
|
||||
|
||||
* Add contextmenu to Event.DOMEvents. [Thomas Fuchs]
|
||||
|
||||
*1.6.0_rc0* (August 15, 2007)
|
||||
|
|
|
@ -87,7 +87,7 @@ Object.extend(Array.prototype, {
|
|||
|
||||
intersect: function(array) {
|
||||
return this.uniq().findAll(function(item) {
|
||||
return array.include(item);
|
||||
return array.detect(function(value) { return item === value });
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -89,11 +89,11 @@ var Enumerable = {
|
|||
|
||||
include: function(object) {
|
||||
if (Object.isFunction(this.indexOf))
|
||||
return this.indexOf(object) != -1;
|
||||
if (this.indexOf(object) != -1) return true;
|
||||
|
||||
var found = false;
|
||||
this.each(function(value) {
|
||||
if (value === object) {
|
||||
if (value == object) {
|
||||
found = true;
|
||||
throw $break;
|
||||
}
|
||||
|
|
|
@ -199,9 +199,10 @@
|
|||
testInclude: function() {with(this) {
|
||||
assert(Fixtures.Nicknames.include('sam-'));
|
||||
assert(Fixtures.Nicknames.include('noradio'));
|
||||
assert(Fixtures.Nicknames.include('htonl'));
|
||||
assert(Fixtures.Nicknames.include('Ulysses'));
|
||||
assert(!Fixtures.Nicknames.include('gmosx'));
|
||||
assert(Fixtures.Basic.include(2));
|
||||
assert(Fixtures.Basic.include('2'));
|
||||
assert(!Fixtures.Basic.include('4'));
|
||||
}},
|
||||
|
||||
testInGroupsOf: function() { with(this) {
|
||||
|
|
Loading…
Reference in New Issue