diff --git a/src/ng/compile.js b/src/ng/compile.js index d231fb40..ba6e6306 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -591,8 +591,10 @@ 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.nodeType == 1 /** Element **/) { + if (node.hasAttribute(attrStart)) depth++; + if (node.hasAttribute(attrEnd)) depth--; + } nodes.push(node); node = node.nextSibling; } while (depth > 0); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 95b2ab72..99c0a6ad 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2747,6 +2747,19 @@ describe('$compile', function() { })); + it('should support grouping over text nodes', inject(function($compile, $rootScope) { + $rootScope.show = false; + element = $compile( + '