diff options
Diffstat (limited to 'src/Compiler.js')
| -rw-r--r-- | src/Compiler.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Compiler.js b/src/Compiler.js index 77c83846..78d7a2b0 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -93,14 +93,17 @@ Compiler.prototype = { } } template = this.templatize(templateElement, index, 0) || new Template(); - return function(scope, element){ - scope = scope || createScope(); - element = element === true - ? templateElement.cloneNode() - : (element ? jqLite(element) : templateElement); + return function(scope, cloneConnectFn){ + // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart + // and sometimes changes the structure of the DOM. + var element = cloneConnectFn + ? JQLitePrototype.clone.call(templateElement) // IMPORTAN!!! + : templateElement; + scope = scope || createScope(); element.data($$scope, scope); - template.attach(element, scope); scope.$element = element; + (cloneConnectFn||noop)(element, scope); + template.attach(element, scope); scope.$eval(); return {scope:scope, view:element}; }; |
