From aa8f4133bec160d40ce164836ab520a654ac4074 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 25 May 2012 21:42:10 +0000 Subject: [PATCH] IE8 fixes --- source/Ox.UI/js/Core/Ox.Theme.js | 5 +++-- source/Ox.UI/js/Core/Ox.URL.js | 2 +- source/Ox.UI/js/Form/Ox.Input.js | 3 ++- source/Ox/js/Type.js | 10 +++++----- tests/js/tests.js | 1 - 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/Ox.UI/js/Core/Ox.Theme.js b/source/Ox.UI/js/Core/Ox.Theme.js index 429be7ef..9b9f864d 100644 --- a/source/Ox.UI/js/Core/Ox.Theme.js +++ b/source/Ox.UI/js/Core/Ox.Theme.js @@ -14,8 +14,9 @@ Ox.Theme = (function() { }; function getTheme() { - var theme = ''; - Ox.forEach(Ox.UI.$body.attr('class').split(' '), function(className) { + var classNames = Ox.UI.$body.attr('class'), + theme = ''; + classNames && Ox.forEach(classNames.split(' '), function(className) { if (Ox.startsWith(className, 'OxTheme')) { theme = className.replace('OxTheme', '').toLowerCase(); Ox.Break(); diff --git a/source/Ox.UI/js/Core/Ox.URL.js b/source/Ox.UI/js/Core/Ox.URL.js index 2308332c..0a97389e 100644 --- a/source/Ox.UI/js/Core/Ox.URL.js +++ b/source/Ox.UI/js/Core/Ox.URL.js @@ -440,7 +440,7 @@ Ox.URL = function(options) { } function parseURL(str, callback) { - // fixme: removing trailing slash makes it impossible to search for '/' + // fixme: removing trailing slash makes it impossible to search for '/' str = str.replace(/(^\/|\/$)/g, ''); var parts = str.split('/'), state = {}; diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js index 49bf297d..71392370 100644 --- a/source/Ox.UI/js/Form/Ox.Input.js +++ b/source/Ox.UI/js/Form/Ox.Input.js @@ -680,7 +680,8 @@ Ox.Input = function(options, self) { } else { end = isArray ? start[1] : (end ? end : start); start = isArray ? start[0] : start; - self.$input[0].setSelectionRange(start, end); + //IE8 does not have setSelectionRange + self.$input[0].setSelectionRange && self.$input[0].setSelectionRange(start, end); } } diff --git a/source/Ox/js/Type.js b/source/Ox/js/Type.js index 737d61b8..03a91943 100644 --- a/source/Ox/js/Type.js +++ b/source/Ox/js/Type.js @@ -357,7 +357,11 @@ if ( var type = Object.prototype.toString.call( value ).slice(8, -1).toLowerCase(); - if (type == 'object' && typeof value.callee == 'function') { + if (value === null) { + type = 'null'; + } else if (value === void 0) { + type = 'undefined' + } else if (type == 'object' && typeof value.callee == 'function') { type = 'arguments'; } else if ( type == 'htmlcollection' || ( @@ -367,10 +371,6 @@ if ( ) ) { type = 'nodelist'; - } else if (value === null) { - type = 'null'; - } else if (value === void 0) { - type = 'undefined' } return type; }; diff --git a/tests/js/tests.js b/tests/js/tests.js index de896e24..f5ccb3b9 100644 --- a/tests/js/tests.js +++ b/tests/js/tests.js @@ -1,5 +1,4 @@ Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() { - Ox.getJSON('../dev/Ox/json/Ox.json', function(files) { var $body = $('body')