diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 52304872..4d4bdb52 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1948,22 +1948,10 @@ getJasmineRequireObj().Clock = function() { }; self.setTimeout = function(fn, delay, params) { - if (legacyIE()) { - if (arguments.length > 2) { - throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill'); - } - return timer.setTimeout(fn, delay); - } return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]); }; self.setInterval = function(fn, delay, params) { - if (legacyIE()) { - if (arguments.length > 2) { - throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill'); - } - return timer.setInterval(fn, delay); - } return Function.prototype.apply.apply(timer.setInterval, [global, arguments]); }; @@ -1998,11 +1986,6 @@ getJasmineRequireObj().Clock = function() { global.clearInterval === realTimingFunctions.clearInterval; } - function legacyIE() { - //if these methods are polyfilled, apply will be present - return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply; - } - function replace(dest, source) { for (var prop in source) { dest[prop] = source[prop]; @@ -2667,28 +2650,7 @@ getJasmineRequireObj().matchersUtil = function(j$) { var bIsDomNode = j$.isDomNode(b); if (aIsDomNode && bIsDomNode) { // At first try to use DOM3 method isEqualNode - if (a.isEqualNode) { - result = a.isEqualNode(b); - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - // IE8 doesn't support isEqualNode, try to use outerHTML && innerText - var aIsElement = a instanceof Element; - var bIsElement = b instanceof Element; - if (aIsElement && bIsElement) { - result = a.outerHTML == b.outerHTML; - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - if (aIsElement || bIsElement) { - diffBuilder.record(a, b); - return false; - } - result = a.innerText == b.innerText && a.textContent == b.textContent; + result = a.isEqualNode(b); if (!result) { diffBuilder.record(a, b); } @@ -4840,12 +4802,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) { } } - var descriptor; - try { - descriptor = Object.getOwnPropertyDescriptor(obj, methodName); - } catch(e) { - // IE 8 doesn't support `definePropery` on non-DOM nodes - } + var descriptor = Object.getOwnPropertyDescriptor(obj, methodName); if (descriptor && !(descriptor.writable || descriptor.set)) { throw new Error(getErrorMsg(methodName + ' is not declared writable or has no setter')); @@ -4887,12 +4844,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) { throw new Error('No property name supplied'); } - var descriptor; - try { - descriptor = j$.util.getPropertyDescriptor(obj, propertyName); - } catch(e) { - // IE 8 doesn't support `definePropery` on non-DOM nodes - } + var descriptor = j$.util.getPropertyDescriptor(obj, propertyName); if (!descriptor) { throw new Error(propertyName + ' property does not exist'); diff --git a/spec/core/ClockSpec.js b/spec/core/ClockSpec.js index 6b3ed1d0..e585149a 100644 --- a/spec/core/ClockSpec.js +++ b/spec/core/ClockSpec.js @@ -389,37 +389,6 @@ describe("Clock", function() { clock.tick(50); }).toThrow(); }); - - it("on IE < 9, fails if extra args are passed to fake clock", function() { - //fail, because this would break in IE9. - var fakeSetTimeout = jasmine.createSpy('setTimeout'), - fakeSetInterval = jasmine.createSpy('setInterval'), - delayedFunctionScheduler = jasmine.createSpyObj('delayedFunctionScheduler', ['scheduleFunction']), - fn = jasmine.createSpy('fn'), - fakeGlobal = { - setTimeout: fakeSetTimeout, - setInterval: fakeSetInterval - }, - mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} }, - clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate); - - fakeSetTimeout.apply = null; - fakeSetInterval.apply = null; - - clock.install(); - - clock.setTimeout(fn, 0); - expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(fn, 0, []); - expect(function() { - clock.setTimeout(fn, 0, 'extra'); - }).toThrow(); - - clock.setInterval(fn, 0); - expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(fn, 0, [], true); - expect(function() { - clock.setInterval(fn, 0, 'extra'); - }).toThrow(); - }); }); describe("Clock (acceptance)", function() { diff --git a/spec/core/ExceptionFormatterSpec.js b/spec/core/ExceptionFormatterSpec.js index ef384dd7..6796ff62 100644 --- a/spec/core/ExceptionFormatterSpec.js +++ b/spec/core/ExceptionFormatterSpec.js @@ -47,8 +47,8 @@ describe("ExceptionFormatter", function() { }); describe("#stack", function() { - it("formats stack traces from Webkit, Firefox, node.js or IE10+", function() { - if (jasmine.getEnv().ieVersion < 10 || jasmine.getEnv().safariVersion < 6) { return; } + it("formats stack traces", function() { + if (jasmine.getEnv().safariVersion < 6) { return; } var error; try { throw new Error("an error") } catch(e) { error = e; } diff --git a/spec/core/PrettyPrintSpec.js b/spec/core/PrettyPrintSpec.js index d15aae10..931c2dba 100644 --- a/spec/core/PrettyPrintSpec.js +++ b/spec/core/PrettyPrintSpec.js @@ -250,11 +250,7 @@ describe("jasmineUnderTest.pp", function () { toString: function () { return Object.prototype.toString.call(this); } }; - if (jasmine.getEnv().ieVersion < 9) { - expect(jasmineUnderTest.pp(objFromOtherContext)).toEqual("Object({ foo: 'bar' })"); - } else { - expect(jasmineUnderTest.pp(objFromOtherContext)).toEqual("Object({ foo: 'bar', toString: Function })"); - } + expect(jasmineUnderTest.pp(objFromOtherContext)).toEqual("Object({ foo: 'bar', toString: Function })"); }); it("should stringify objects have have a toString that isn't a function", function() { @@ -262,11 +258,7 @@ describe("jasmineUnderTest.pp", function () { toString: "foo" }; - if (jasmine.getEnv().ieVersion < 9) { - expect(jasmineUnderTest.pp(obj)).toEqual("Object({ })"); - } else { - expect(jasmineUnderTest.pp(obj)).toEqual("Object({ toString: 'foo' })"); - } + expect(jasmineUnderTest.pp(obj)).toEqual("Object({ toString: 'foo' })"); }); it("should stringify objects from anonymous constructors with custom toString", function () { @@ -279,8 +271,6 @@ describe("jasmineUnderTest.pp", function () { }); it("should handle objects with null prototype", function() { - if (jasmine.getEnv().ieVersion < 9) { return; } - var obj = Object.create(null); obj.foo = 'bar'; diff --git a/spec/core/SpyRegistrySpec.js b/spec/core/SpyRegistrySpec.js index 4f09c932..b25dbaaa 100644 --- a/spec/core/SpyRegistrySpec.js +++ b/spec/core/SpyRegistrySpec.js @@ -54,9 +54,6 @@ describe("SpyRegistry", function() { }); it("checks if it can be spied upon", function() { - // IE 8 doesn't support `definePropery` on non-DOM nodes - if (jasmine.getEnv().ieVersion < 9) { return; } - var scope = {}; function myFunc() { @@ -94,9 +91,6 @@ describe("SpyRegistry", function() { }); describe("#spyOnProperty", function() { - // IE 8 doesn't support `definePropery` on non-DOM nodes - if (jasmine.getEnv().ieVersion < 9) { return; } - it("checks for the existence of the object", function() { var spyRegistry = new jasmineUnderTest.SpyRegistry(); expect(function() { @@ -246,9 +240,6 @@ describe("SpyRegistry", function() { }); it("does not add a property that the spied-upon object didn't originally have", function() { - // IE 8 doesn't support `Object.create` - if (jasmine.getEnv().ieVersion < 9) { return; } - var spies = [], spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}), originalFunction = function() {}, @@ -266,9 +257,6 @@ describe("SpyRegistry", function() { }); it("restores the original function when it\'s inherited and cannot be deleted", function() { - // IE 8 doesn't support `Object.create` or `Object.defineProperty` - if (jasmine.getEnv().ieVersion < 9) { return; } - var spies = [], spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}), originalFunction = function() {}, @@ -291,9 +279,6 @@ describe("SpyRegistry", function() { describe('spying on properties', function() { it("restores the original properties on the spied-upon objects", function() { - // IE 8 doesn't support `definePropery` on non-DOM nodes - if (jasmine.getEnv().ieVersion < 9) { return; } - var spies = [], spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}), originalReturn = 1, @@ -311,9 +296,6 @@ describe("SpyRegistry", function() { }); it("does not add a property that the spied-upon object didn't originally have", function() { - // IE 8 doesn't support `Object.create` - if (jasmine.getEnv().ieVersion < 9) { return; } - var spies = [], spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}), originalReturn = 1, diff --git a/spec/core/UtilSpec.js b/spec/core/UtilSpec.js index faaca2c2..84f08b8f 100644 --- a/spec/core/UtilSpec.js +++ b/spec/core/UtilSpec.js @@ -43,9 +43,6 @@ describe("jasmineUnderTest.util", function() { }); describe("getPropertyDescriptor", function() { - // IE 8 doesn't support `definePropery` on non-DOM nodes - if (jasmine.getEnv().ieVersion < 9) { return; } - it("get property descriptor from object", function() { var obj = {prop: 1}, actual = jasmineUnderTest.util.getPropertyDescriptor(obj, 'prop'), diff --git a/spec/core/asymmetric_equality/ObjectContainingSpec.js b/spec/core/asymmetric_equality/ObjectContainingSpec.js index fd2f5e66..e2741a9d 100644 --- a/spec/core/asymmetric_equality/ObjectContainingSpec.js +++ b/spec/core/asymmetric_equality/ObjectContainingSpec.js @@ -57,9 +57,6 @@ describe("ObjectContaining", function() { }); it("matches defined properties", function(){ - // IE 8 doesn't support `definePropery` on non-DOM nodes - if (jasmine.getEnv().ieVersion < 9) { return; } - var containing = new jasmineUnderTest.ObjectContaining({ foo: "fooVal" }); var definedPropertyObject = {}; diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index b5cfc29f..dee3d9be 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -1164,12 +1164,9 @@ describe("Env integration", function() { env.describe('suite', function() { env.afterAll(function() { - if (jasmine.getEnv().ieVersion < 9) { - } else { - realSetTimeout(function() { - jasmine.clock().tick(10); - }, 100); - } + realSetTimeout(function() { + jasmine.clock().tick(10); + }, 100); }); env.describe('beforeAll', function() { env.beforeAll(function(innerDone) { diff --git a/spec/core/matchers/matchersUtilSpec.js b/spec/core/matchers/matchersUtilSpec.js index 98795db5..de2dae30 100644 --- a/spec/core/matchers/matchersUtilSpec.js +++ b/spec/core/matchers/matchersUtilSpec.js @@ -156,8 +156,6 @@ describe("matchersUtil", function() { }); it("passes for equivalent frozen objects (GitHub issue #266)", function() { - if (jasmine.getEnv().ieVersion < 9) { return; } - var a = { foo: 1 }, b = {foo: 1 }; @@ -191,10 +189,6 @@ describe("matchersUtil", function() { if (isNotRunningInBrowser()) { return; } - // iframe.contentWindow.eval isn't supported in ie8 - if (jasmine.getEnv().ieVersion < 9) { - return; - } var iframe = document.createElement('iframe'); document.body.appendChild(iframe); iframe.contentWindow.eval('window.testObject = {}'); @@ -356,8 +350,6 @@ describe("matchersUtil", function() { }); it("passes for null prototype objects with same properties", function () { - if (jasmine.getEnv().ieVersion < 9) { return; } - var objA = Object.create(null), objB = Object.create(null); @@ -368,8 +360,6 @@ describe("matchersUtil", function() { }); it("fails for null prototype objects with different properties", function () { - if (jasmine.getEnv().ieVersion < 9) { return; } - var objA = Object.create(null), objB = Object.create(null); @@ -449,9 +439,6 @@ describe("matchersUtil", function() { }); describe("when running in an environment with array polyfills", function() { - // IE 8 doesn't support `definePropery` on non-DOM nodes - if (jasmine.getEnv().ieVersion < 9) { return; } - var findIndexDescriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'findIndex'); if (!findIndexDescriptor) { return; diff --git a/spec/core/matchers/toEqualSpec.js b/spec/core/matchers/toEqualSpec.js index 2c4916bb..c3115644 100644 --- a/spec/core/matchers/toEqualSpec.js +++ b/spec/core/matchers/toEqualSpec.js @@ -299,22 +299,7 @@ describe("toEqual", function() { expect(compareEquals(actual, expected).message).toEqual(message); }); - function constructorIsNotEnumerable() { - // in IE8, the constructor property is not enumerable, even if it is an - // own property of the object. - // Objects that differ only by an own `constructor` property are thus - // considered equal in IE8. - for (var key in {constructor: 1}) { - return false; - } - return true; - } - it("reports mismatches between objects with their own constructor property", function () { - if (constructorIsNotEnumerable()) { - return; - } - function Foo() {} function Bar() {} @@ -326,10 +311,6 @@ describe("toEqual", function() { }); it("reports mismatches between an object with a real constructor and one with its own constructor property", function () { - if (constructorIsNotEnumerable()) { - return; - } - function Foo() {} function Bar() {} diff --git a/spec/core/matchers/toThrowErrorSpec.js b/spec/core/matchers/toThrowErrorSpec.js index c7750e80..eaa9c137 100644 --- a/spec/core/matchers/toThrowErrorSpec.js +++ b/spec/core/matchers/toThrowErrorSpec.js @@ -79,7 +79,7 @@ describe("toThrowError", function() { }); it("passes if thrown is an instanceof Error regardless of global that contains its constructor", function() { - if (isNotRunningInBrowser() || jasmine.getEnv().phantomVersion < 2 || jasmine.getEnv().ieVersion < 10) { + if (isNotRunningInBrowser() || jasmine.getEnv().phantomVersion < 2) { return; } @@ -92,7 +92,7 @@ describe("toThrowError", function() { iframeDocument.body.appendChild(iframeDocument.createElement("script")) .textContent = "function method() { throw new Error('foo'); }"; } else { - // older IE + // IE 10 and older iframeDocument.write(""); } diff --git a/spec/helpers/BrowserFlags.js b/spec/helpers/BrowserFlags.js index 77d1a1e9..128d133e 100644 --- a/spec/helpers/BrowserFlags.js +++ b/spec/helpers/BrowserFlags.js @@ -8,10 +8,6 @@ return match ? parseFloat(match[1]) : void 0; } - env.ieVersion = browserVersion(function(userAgent) { - return /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(userAgent); - }); - env.safariVersion = browserVersion(function(userAgent) { return /Safari/.exec(userAgent) && /Version\/([0-9]{0,})/.exec(userAgent); }); diff --git a/src/core/Clock.js b/src/core/Clock.js index 52fafcfe..a0602c6a 100644 --- a/src/core/Clock.js +++ b/src/core/Clock.js @@ -83,22 +83,10 @@ getJasmineRequireObj().Clock = function() { }; self.setTimeout = function(fn, delay, params) { - if (legacyIE()) { - if (arguments.length > 2) { - throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill'); - } - return timer.setTimeout(fn, delay); - } return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]); }; self.setInterval = function(fn, delay, params) { - if (legacyIE()) { - if (arguments.length > 2) { - throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill'); - } - return timer.setInterval(fn, delay); - } return Function.prototype.apply.apply(timer.setInterval, [global, arguments]); }; @@ -133,11 +121,6 @@ getJasmineRequireObj().Clock = function() { global.clearInterval === realTimingFunctions.clearInterval; } - function legacyIE() { - //if these methods are polyfilled, apply will be present - return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply; - } - function replace(dest, source) { for (var prop in source) { dest[prop] = source[prop]; diff --git a/src/core/SpyRegistry.js b/src/core/SpyRegistry.js index d8d4cf7f..139bfa3d 100644 --- a/src/core/SpyRegistry.js +++ b/src/core/SpyRegistry.js @@ -32,12 +32,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) { } } - var descriptor; - try { - descriptor = Object.getOwnPropertyDescriptor(obj, methodName); - } catch(e) { - // IE 8 doesn't support `definePropery` on non-DOM nodes - } + var descriptor = Object.getOwnPropertyDescriptor(obj, methodName); if (descriptor && !(descriptor.writable || descriptor.set)) { throw new Error(getErrorMsg(methodName + ' is not declared writable or has no setter')); @@ -79,12 +74,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) { throw new Error('No property name supplied'); } - var descriptor; - try { - descriptor = j$.util.getPropertyDescriptor(obj, propertyName); - } catch(e) { - // IE 8 doesn't support `definePropery` on non-DOM nodes - } + var descriptor = j$.util.getPropertyDescriptor(obj, propertyName); if (!descriptor) { throw new Error(propertyName + ' property does not exist'); diff --git a/src/core/matchers/matchersUtil.js b/src/core/matchers/matchersUtil.js index 71fc0047..c05f2a83 100644 --- a/src/core/matchers/matchersUtil.js +++ b/src/core/matchers/matchersUtil.js @@ -182,28 +182,7 @@ getJasmineRequireObj().matchersUtil = function(j$) { var bIsDomNode = j$.isDomNode(b); if (aIsDomNode && bIsDomNode) { // At first try to use DOM3 method isEqualNode - if (a.isEqualNode) { - result = a.isEqualNode(b); - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - // IE8 doesn't support isEqualNode, try to use outerHTML && innerText - var aIsElement = a instanceof Element; - var bIsElement = b instanceof Element; - if (aIsElement && bIsElement) { - result = a.outerHTML == b.outerHTML; - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - if (aIsElement || bIsElement) { - diffBuilder.record(a, b); - return false; - } - result = a.innerText == b.innerText && a.textContent == b.textContent; + result = a.isEqualNode(b); if (!result) { diffBuilder.record(a, b); }