angular/angular.js — pull request #4657 by casebeer (2013-10-26 04:32:03+00:00)
Title: Fix for style attribute interpolation in templates for directives with replace: true

We encountered a bug when attempting to interpolate values in the style attribute on the top level DOM node of directives that set replace: true.

The problem appears to stem from templateMergeAttributes() in compile.js, where the style attribute is special cased, but its value is never copied to the `dst` object for use by the attrInterpolatePreLinkFn. Since attrInterpolatePreLinkFn gets an attrs object with no style property, $interpolate() throws an exception when it receives `undefined` as its text arg and attempts to dereference its `length` property.

I've fixed this by doing the copy to the `dst` object in templateMergeAttributes().

Joe has written a unit test in test/ng/compileSpec.js for the issue, which fails for the previous commit and passes with my patch.