fix($compile): fix regression which affected old jQuery releases

ddb8081 and 4ea57e7 removed the calls which trimmed leading and trailing whitespace from templates
in the HTML compiler. This broke old versions of jQuery (such as 1.9.1), which do not trim
whitespace in their constructors. Naturally, this would not appear in the jQuery tests, as we are
testing against a version which does trim whitespace in the constructor.

This fix re-adds calls to `trim()` when compiling templates in $compile, in order to avoid breaking
old versions of jQuery.
This commit is contained in:
Caitlin Potter
2014-04-05 08:58:16 -04:00
parent d53a787f0d
commit a97a172ee9

View File

@@ -1258,7 +1258,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if (jqLiteIsTextNode(directiveValue)) {
$template = [];
} else {
$template = jqLite(directiveValue);
$template = jqLite(trim(directiveValue));
}
compileNode = $template[0];
@@ -1685,7 +1685,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if (jqLiteIsTextNode(content)) {
$template = [];
} else {
$template = jqLite(content);
$template = jqLite(trim(content));
}
compileNode = $template[0];