Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($compile): support text inside multi-element directive #2859

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ng/compile.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ function $CompileProvider($provide) {
if (!node) {
throw ngError(51, "Unterminated attribute, found '{0}' but no matching '{1}' found.", attrStart, attrEnd);
}
if (node.hasAttribute(attrStart)) depth++;
if (node.hasAttribute(attrEnd)) depth--;
if (node.hasAttribute && node.hasAttribute(attrStart)) depth++;
if (node.hasAttribute && node.hasAttribute(attrEnd)) depth--;
nodes.push(node);
node = node.nextSibling;
} while (depth > 0);
Expand Down
11 changes: 11 additions & 0 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2746,6 +2746,17 @@ describe('$compile', function() {
expect(element.text()).toEqual('1A1B;2A2B;');
}));

it('should group on embedded text nodes', inject(function($compile, $rootScope) {
$rootScope.show = false;
element = $compile(
'<div>' +
'<span ng-repeat-start="i in [1,2]">{{i}}A</span>' +
'X' +
'<span ng-repeat-end>{{i}}B;</span>' +
'</div>')($rootScope);
$rootScope.$digest();
expect(element.text()).toEqual('1AX1B;2AX2B;');
}));

it('should group on $root compile function', inject(function($compile, $rootScope) {
$rootScope.show = false;
Expand Down