From eb9cd1e3975b9ef956457c9395db470a10148d03 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 25 May 2012 16:28:05 +0000 Subject: [PATCH] IE fixes --- source/Ox.UI/js/Core/Ox.LoadingIcon.js | 1 + source/Ox.UI/js/Form/Ox.Filter.js | 4 ++-- source/Ox.js | 7 ++++++- source/Ox/js/Collection.js | 14 ++++++++++++++ source/Ox/js/Format.js | 4 ++-- source/Ox/js/JavaScript.js | 2 +- source/Ox/js/Object.js | 2 +- source/Ox/js/Request.js | 4 +++- tests/js/tests.js | 5 ++++- 9 files changed, 34 insertions(+), 9 deletions(-) diff --git a/source/Ox.UI/js/Core/Ox.LoadingIcon.js b/source/Ox.UI/js/Core/Ox.LoadingIcon.js index 8d531cb0..5b8556f1 100644 --- a/source/Ox.UI/js/Core/Ox.LoadingIcon.js +++ b/source/Ox.UI/js/Core/Ox.LoadingIcon.js @@ -40,6 +40,7 @@ Ox.LoadingIcon = function(options, self) { css = 'rotate(' + deg + 'deg)'; that.css({ MozTransform: css, + MsTransform: css, OTransform: css, WebkitTransform: css }); diff --git a/source/Ox.UI/js/Form/Ox.Filter.js b/source/Ox.UI/js/Form/Ox.Filter.js index da3f58f4..555af1e1 100644 --- a/source/Ox.UI/js/Form/Ox.Filter.js +++ b/source/Ox.UI/js/Form/Ox.Filter.js @@ -60,7 +60,7 @@ Ox.Filter = function(options, self) { {id: '=,', title: 'is between'}, {id: '!=,', title: 'is not between'} ], - enum: [ + 'enum': [ {id: '=', title: 'is'}, {id: '!=', title: 'is not'}, {id: '<', title: 'is less than'}, @@ -112,7 +112,7 @@ Ox.Filter = function(options, self) { self.defaultValue = { boolean: 'true', date: Ox.formatDate(new Date(), '%F'), - enum: 0, + 'enum': 0, float: 0, hue: 0, integer: 0, diff --git a/source/Ox.js b/source/Ox.js index 24c1e238..f4d738f5 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -87,7 +87,12 @@ window.Ox = { function loadScript(script, callback) { var element = document.createElement('script'), head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; - element.onload = callback; + if (/MSIE/.test(navigator.userAgent)) { + // fixme: find a way to check if css/js have loaded in msie + setTimeout(callback, 2500); + } else { + element.onload = callback; + } element.src = path + script + '?' + parseInt(Math.random() * 1000000); element.type = 'text/javascript'; head.appendChild(element); diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index d7848811..92a024cc 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -456,10 +456,24 @@ Ox.shuffle = function(collection) { Ox.slice Alias for Array.prototype.slice.call > (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 Tests if one or more elements of a collection meet a given condition diff --git a/source/Ox/js/Format.js b/source/Ox/js/Format.js index 3e2345d0..d0332c7b 100644 --- a/source/Ox/js/Format.js +++ b/source/Ox/js/Format.js @@ -38,7 +38,7 @@ Ox.formatDate Formats a date according to a format string date date utc date is utc > Ox.formatDate(Ox.test.date, '%A') // Full weekday 'Sunday' @@ -253,7 +253,7 @@ Ox.formatDate 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); diff --git a/source/Ox/js/JavaScript.js b/source/Ox/js/JavaScript.js index 93b1bdb9..c792c48d 100644 --- a/source/Ox/js/JavaScript.js +++ b/source/Ox/js/JavaScript.js @@ -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) { diff --git a/source/Ox/js/Object.js b/source/Ox/js/Object.js index 7b8f52a6..82407e73 100644 --- a/source/Ox/js/Object.js +++ b/source/Ox/js/Object.js @@ -182,4 +182,4 @@ Ox.unserialize = function(string, toNumber) { } }); return ret; -}; \ No newline at end of file +}; diff --git a/source/Ox/js/Request.js b/source/Ox/js/Request.js index d6a38c59..d335b5a1 100644 --- a/source/Ox/js/Request.js +++ b/source/Ox/js/Request.js @@ -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; diff --git a/tests/js/tests.js b/tests/js/tests.js index 1d933dfb..de896e24 100644 --- a/tests/js/tests.js +++ b/tests/js/tests.js @@ -36,7 +36,7 @@ Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() { function tests() { var passed = 0, failed = 0, lines, spaces, command, expected, result, passed, - replace = ['', ''], fns = [], $test + replace = ['', ''], fns = [], $test; Ox.forEach(Ox.isArray(arguments[0]) ? arguments[0] : arguments, function(script, i) { Ox.print(script) Ox.test(script, function(results) { @@ -101,6 +101,9 @@ Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() { colors[+passed][1] + '))' }); }); + $.browser.msie && $element.css({ + background: 'rgb(' + colors[+passed][0] + ')' + }); } });