diff --git a/lib/core_dom/tagging_compiler.dart b/lib/core_dom/tagging_compiler.dart index fbc564139..522cbd24b 100644 --- a/lib/core_dom/tagging_compiler.dart +++ b/lib/core_dom/tagging_compiler.dart @@ -21,6 +21,7 @@ class TaggingCompiler implements Compiler { TaggedElementBinder directParentElementBinder, List elementBinders) { assert(parentElementBinderOffset != null); + assert(parentElementBinderOffset < elementBinders.length); if (domCursor.current == null) return null; do { @@ -41,8 +42,7 @@ class TaggingCompiler implements Compiler { if (elementBinder.hasTemplate) { elementBinder.templateViewFactory = _compileTransclusion( elementBinders, domCursor, templateCursor, elementBinder.template, - elementBinder.templateBinder, directives, - parentElementBinderOffset); + elementBinder.templateBinder, directives); } } @@ -110,8 +110,7 @@ class TaggingCompiler implements Compiler { NodeCursor domCursor, NodeCursor templateCursor, DirectiveRef directiveRef, ElementBinder transcludedElementBinder, - DirectiveMap directives, - int parentElementBinderOffset) { + DirectiveMap directives) { var anchorName = directiveRef.annotation.selector + (directiveRef.value != null ? '=' + directiveRef.value : ''); var viewFactory; @@ -121,7 +120,7 @@ class TaggingCompiler implements Compiler { var domCursorIndex = domCursor.index; var elementBinders = []; _compileView(domCursor, transcludeCursor, transcludedElementBinder, - directives, parentElementBinderOffset, null, elementBinders); + directives, -1, null, elementBinders); viewFactory = new TaggingViewFactory(transcludeCursor.elements, elementBinders, _perf, _expando); diff --git a/test/core_dom/compiler_spec.dart b/test/core_dom/compiler_spec.dart index de282f120..80bc34c05 100644 --- a/test/core_dom/compiler_spec.dart +++ b/test/core_dom/compiler_spec.dart @@ -92,7 +92,7 @@ void main() { expect(element.html()).toEqual(''); })); - it('should compile a repeater as a child', () { + it('should compile a text child of a basic repeater', () { var element = $(_.compile( '
' + '{{r}}' + @@ -101,6 +101,13 @@ void main() { expect(element.text()).toEqual('12'); }); + it('should compile a text child of a repeat with a directive', () { + _.compile( + '
' + '{{r}}' + '
'); + }); + it('should compile repeater with children', inject((Compiler $compile) { var element = $(_.compile('
'));