diff options
| -rw-r--r-- | src/ng/compile.js | 3 | ||||
| -rwxr-xr-x | test/ng/compileSpec.js | 26 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js index 1bc059b3..a4e44f01 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -816,8 +816,9 @@ function $CompileProvider($provide) { if (directiveValue = directive.transclude) { assertNoDuplicate('transclusion', transcludeDirective, directive, $compileNode); transcludeDirective = directive; - terminalPriority = directive.priority; + if (directiveValue == 'element') { + terminalPriority = directive.priority; $template = groupScan(compileNode, attrStart, attrEnd) $compileNode = templateAttrs.$$element = jqLite(document.createComment(' ' + directiveName + ': ' + templateAttrs[directiveName] + ' ')); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 1e66b49f..f164ca7a 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2905,6 +2905,30 @@ describe('$compile', function() { expect(log).toEqual('pre(); post(unicorn!)'); }); }); + + + it('should terminate compilation only for element trasclusion', function() { + module(function() { + directive('elementTrans', function(log) { + return { + transclude: 'element', + priority: 50, + compile: log.fn('compile:elementTrans') + }; + }); + directive('regularTrans', function(log) { + return { + transclude: true, + priority: 50, + compile: log.fn('compile:regularTrans') + }; + }); + }); + inject(function(log, $compile, $rootScope) { + $compile('<div><div element-trans log="elem"></div><div regular-trans log="regular"></div></div>')($rootScope); + expect(log).toEqual('compile:elementTrans; compile:regularTrans; regular'); + }); + }); }); @@ -3256,7 +3280,7 @@ describe('$compile', function() { $rootScope.dataOnVar = 'data-on text'; $rootScope.$apply(); expect(element.attr('data-on')).toEqual('data-on text'); - + element = $compile('<button on="{{onVar}}"></script>')($rootScope); $rootScope.onVar = 'on text'; $rootScope.$apply(); |
