diff --git a/src/ng/compile.js b/src/ng/compile.js index cfa72d972e67..1aae79b586bc 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1652,7 +1652,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { // reapply the old attributes to the new element forEach(dst, function(value, key) { if (key.charAt(0) != '$') { - if (src[key]) { + if (src[key] && src[key] !== value) { value += (key === 'style' ? ';' : ' ') + src[key]; } dst.$set(key, value, true, srcAttr[key]); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index b3af196f3bb7..3f0b1be260b3 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -492,6 +492,15 @@ describe('$compile', function() { expect(element).toBe(attr.$$element); } })); + directive('nomerge', valueFn({ + restrict: 'CAM', + replace: true, + template: '