diff --git a/lib/core_dom/compiler.dart b/lib/core_dom/compiler.dart index f7f041163..c61c654f4 100644 --- a/lib/core_dom/compiler.dart +++ b/lib/core_dom/compiler.dart @@ -151,6 +151,7 @@ class Compiler { break; case '<=>': mappingFn = (NodeAttrs attrs, Scope scope, Object dst) { + if (attrs[attrName] == null) return; Expression attrExprFn = _parser(attrs[attrName]); var shadowValue = null; scope.$watch( @@ -172,6 +173,7 @@ class Compiler { break; case '=>': mappingFn = (NodeAttrs attrs, Scope scope, Object dst) { + if (attrs[attrName] == null) return; Expression attrExprFn = _parser(attrs[attrName]); var shadowValue = null; scope.$watch( @@ -182,6 +184,7 @@ class Compiler { break; case '=>!': mappingFn = (NodeAttrs attrs, Scope scope, Object dst) { + if (attrs[attrName] == null) return; Expression attrExprFn = _parser(attrs[attrName]); var stopWatching; stopWatching = scope.$watch( diff --git a/test/core_dom/compiler_spec.dart b/test/core_dom/compiler_spec.dart index 2845b042e..23d746488 100644 --- a/test/core_dom/compiler_spec.dart +++ b/test/core_dom/compiler_spec.dart @@ -244,6 +244,14 @@ main() => describe('dte.compiler', () { expect($rootScope.done).toEqual(true); }))); + it('should should not create any watchers if no attributes are specified', async(inject((Profiler perf) { + var element = $(r'