fix($compile): correctly handle interpolated style in replace templates

A directive with a template with `replace: true` and an interpolated style at the root element should work correctly.

Closes #4882.
This commit is contained in:
Tobias Bosch
2013-11-12 15:53:06 -08:00
parent fa82a31fa6
commit e1254b266d
2 changed files with 19 additions and 1 deletions

View File

@@ -1588,6 +1588,7 @@ function $CompileProvider($provide) {
dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
} else if (key == 'style') {
$element.attr('style', $element.attr('style') + ';' + value);
dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
// `dst` will never contain hasOwnProperty as DOM parser won't let it.
// You will get an "InvalidCharacterError: DOM Exception 5" error if you
// have an attribute like "has-own-property" or "data-has-own-property", etc.