IE fixes
This commit is contained in:
parent
d83046460f
commit
eb9cd1e397
9 changed files with 34 additions and 9 deletions
|
|
@ -456,10 +456,24 @@ Ox.shuffle = function(collection) {
|
|||
Ox.slice <f> Alias for <code>Array.prototype.slice.call</code>
|
||||
> (function() { return Ox.slice(arguments, 1, -1); }(1, 2, 3))
|
||||
[2]
|
||||
> (function() { return Ox.slice(arguments, 1); }(1, 2, 3))
|
||||
[2, 3]
|
||||
@*/
|
||||
Ox.slice = function(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 array of nulls if a string is passed to Array.prototype.slice.call
|
||||
if(Ox.slice([1]).length == 0 || Ox.slice('a')[0] == null) {
|
||||
Ox.slice = function(value, start, stop) {
|
||||
if(Ox.typeOf(value) == 'string')
|
||||
value = value.split('')
|
||||
return stop === void 0
|
||||
? Array.prototype.slice.call(value, start)
|
||||
: Array.prototype.slice.call(value, start, stop);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/*@
|
||||
Ox.some <f> Tests if one or more elements of a collection meet a given condition
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Ox.formatDate <f> Formats a date according to a format string
|
|||
date <d|n|s> date
|
||||
utc <b> date is utc
|
||||
<script>
|
||||
Ox.test.date = new Date('2005-01-02 00:03:04');
|
||||
Ox.test.date = new Date('2005/01/02 00:03:04');
|
||||
</script>
|
||||
> Ox.formatDate(Ox.test.date, '%A') // Full weekday
|
||||
'Sunday'
|
||||
|
|
@ -253,7 +253,7 @@ Ox.formatDate <f> Formats a date according to a format string
|
|||
return Ox.getFullYear(date, utc).toString().slice(-2);
|
||||
}],
|
||||
['Z', function(date) {
|
||||
return date.toString().split('(')[1].replace(')', '');
|
||||
return (date.toString().split('(')[1] || '').replace(')', '');
|
||||
}],
|
||||
['z', function(date) {
|
||||
return Ox.getTimezoneOffsetString(date);
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ Ox.doc = (function() {
|
|||
array = string.split(':');
|
||||
string = array[0];
|
||||
if (array.length == 2) {
|
||||
ret.super = array[1];
|
||||
ret['super'] = array[1];
|
||||
}
|
||||
}
|
||||
string.split('|').forEach(function(string) {
|
||||
|
|
|
|||
|
|
@ -182,4 +182,4 @@ Ox.unserialize = function(string, toNumber) {
|
|||
}
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -126,12 +126,14 @@ Ox.loadFile = (function() {
|
|||
);
|
||||
element[type == 'css' ? 'href' : 'src'] = file + '?' + Ox.random(1000000);
|
||||
element.type = type == 'css' ? 'text/css' : 'text/javascript';
|
||||
if (type == 'css') {
|
||||
element.rel = 'stylesheet';
|
||||
}
|
||||
if (/MSIE/.test(navigator.userAgent)) {
|
||||
// fixme: find a way to check if css/js have loaded in msie
|
||||
setTimeout(addFileToCache, 2500);
|
||||
} else {
|
||||
if (type == 'css') {
|
||||
element.rel = 'stylesheet';
|
||||
waitForCSS();
|
||||
} else {
|
||||
element.onload = addFileToCache;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue