From a61d47e3d10745530bf6960a1061ff9707b0272f Mon Sep 17 00:00:00 2001 From: David Luecke Date: Tue, 22 Jan 2013 23:17:24 -0700 Subject: [PATCH] Test and fix for IE error, issue #226 --- observe/observe.js | 2 +- observe/observe_test.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/observe/observe.js b/observe/observe.js index af312044c6b..73629d72785 100644 --- a/observe/observe.js +++ b/observe/observe.js @@ -1029,7 +1029,7 @@ steal('can/util','can/construct', function(can) { this.length = 0; can.cid(this, ".observe") this._init = 1; - this.push.apply(this, instances || []); + this.push.apply(this, can.makeArray(instances || [])); this.bind('change'+this._cid,can.proxy(this._changes,this)); can.extend(this, options); delete this._init; diff --git a/observe/observe_test.js b/observe/observe_test.js index 8185f7bd937..38428696043 100644 --- a/observe/observe_test.js +++ b/observe/observe_test.js @@ -591,4 +591,11 @@ test("replace with a deferred that resolves to an Observe.List", function(){ list.replace(def); }); +test("IE8 error on list setup with Observe.List (#226)", function() { + var list = new can.Observe.List(['first', 'second', 'third']), + otherList = new can.Observe.List(list); + + deepEqual(list.attr(), otherList.attr(), 'Lists are the same'); +}); + })();