handle FF 3.6

This commit is contained in:
rolux 2012-05-25 19:09:25 +02:00
parent 4aded58b95
commit dfbbcd113b

View file

@ -462,19 +462,25 @@ Ox.slice <f> Alias for <code>Array.prototype.slice.call</code>
Ox.slice = function(value, start, stop) { Ox.slice = function(value, start, stop) {
return Array.prototype.slice.call(value, start, stop); return Array.prototype.slice.call(value, start, stop);
}; };
//IE8 returns an empty array if undefined is passed as start, stop // IE8 returns an empty array if undefined is passed as stop
//IE8 returns an array of nulls if a string is passed to Array.prototype.slice.call // and an array of null values if a string is passed as value.
if(Ox.slice([1]).length == 0 || Ox.slice('a')[0] == null) { // Firefox 3.6 returns an array of undefined values
// if a string is passed as value.
if (
Ox.slice([0]).length == 0
|| Ox.slice('0')[0] === null
|| Ox.slice('0')[0] === void 0
) {
Ox.slice = function(value, start, stop) { Ox.slice = function(value, start, stop) {
if(Ox.typeOf(value) == 'string') if (Ox.typeOf(value) == 'string') {
value = value.split('') value = value.split('');
}
return stop === void 0 return stop === void 0
? Array.prototype.slice.call(value, start) ? Array.prototype.slice.call(value, start)
: Array.prototype.slice.call(value, start, stop); : Array.prototype.slice.call(value, start, stop);
}; };
} }
/*@ /*@
Ox.some <f> Tests if one or more elements of a collection meet a given condition Ox.some <f> Tests if one or more elements of a collection meet a given condition
Unlike <code>[].some()</code>, <code>Ox.some()</code> works for arrays, Unlike <code>[].some()</code>, <code>Ox.some()</code> works for arrays,