Fix bug in IE where clone removes whitespace nodes.

This commit is contained in:
Elliott Sprehn 2010-10-05 07:08:18 +08:00 committed by Misko Hevery
parent 81052d4a62
commit 8e40e7070d
3 changed files with 6 additions and 2 deletions

View file

@ -153,6 +153,10 @@ if (msie) {
};
}
function quickClone(element) {
return jqLite(element[0].cloneNode(true));
}
function isVisible(element) {
var rect = element[0].getBoundingClientRect(),
width = (rect.width || (rect.right||0 - rect.left||0)),

View file

@ -176,7 +176,7 @@ angularWidget("@ng:repeat", function(expression, element){
if (keyIdent) childScope[keyIdent] = key;
} else {
// grow children
childScope = template(element.clone(), createScope(currentScope));
childScope = template(quickClone(element), createScope(currentScope));
childScope[valueIdent] = collection[key];
if (keyIdent) childScope[keyIdent] = key;
lastElement.after(childScope.$element);

View file

@ -320,7 +320,7 @@ var ngSwitch = angularWidget('ng:switch', function (element){
childScope = createScope(scope);
foreach(cases, function(switchCase){
if (switchCase.when(childScope, value)) {
var caseElement = switchCase.element.clone();
var caseElement = quickClone(switchCase.element);
element.append(caseElement);
childScope.$tryEval(switchCase.change, element);
switchCase.template(caseElement, childScope);