mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
Fix bug in IE where clone removes whitespace nodes.
This commit is contained in:
parent
81052d4a62
commit
8e40e7070d
3 changed files with 6 additions and 2 deletions
|
|
@ -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)),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue