diff options
| author | Misko Hevery | 2011-02-13 16:13:21 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-02-16 08:59:57 -0500 |
| commit | c90abf057b0370cf5beb62aa960f1df008c802ef (patch) | |
| tree | 039525ec1ee518175010693efd278fa105815285 /src/Compiler.js | |
| parent | cdc093a463e8f8a925cbb9f2b55bedf0a1d8e7e8 (diff) | |
| download | angular.js-c90abf057b0370cf5beb62aa960f1df008c802ef.tar.bz2 | |
Changed the angular.compile(element)(scope[, cloneAttachNode])
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}; }; |
