From 0396054b4a420972e16d0d9e965eb51ecd6f86a2 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 22 Apr 2010 22:44:48 -0700 Subject: fixed the way IE breaks parests on innerHTML --- src/jqLite.js | 8 +++----- src/widgets.js | 5 +++++ test.sh | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/jqLite.js b/src/jqLite.js index 18589630..134c1e17 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -211,11 +211,9 @@ JQLite.prototype = { html: function(value) { if (isDefined(value)) { - var parent = this[0], child; - while(parent.childNodes.length) { - child = parent.childNodes[0]; - jqLite(child).dealoc(); - parent.removeChild(child); + var i = 0, childNodes = this[0].childNodes; + for ( ; i < childNodes.length; i++) { + jqLite(childNodes[i]).dealoc(); } this[0].innerHTML = value; } diff --git a/src/widgets.js b/src/widgets.js index 209b24b7..8a816934 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -239,6 +239,11 @@ var ngSwitch = angularWidget('NG:SWITCH', function (element){ } }); + // this needs to be here for IE + foreach(cases, function(_case){ + _case.element.remove(); + }); + element.html(''); return function(element){ var scope = this, childScope; diff --git a/test.sh b/test.sh index 54e1a93a..e1ab0d16 100755 --- a/test.sh +++ b/test.sh @@ -1,2 +1,2 @@ # java -jar lib/jstestdriver/JsTestDriver.jar --tests all -java -jar lib/jstestdriver/JsTestDriver.jar --tests all --config jsTestDriver-jquery.conf +java -jar lib/jstestdriver/JsTestDriver.jar --tests 'widget ng:switch' --config jsTestDriver-jquery.conf -- cgit v1.2.3