Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit a97a172

Browse files
committed
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.
1 parent d53a787 commit a97a172

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ng/compile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
12581258
if (jqLiteIsTextNode(directiveValue)) {
12591259
$template = [];
12601260
} else {
1261-
$template = jqLite(directiveValue);
1261+
$template = jqLite(trim(directiveValue));
12621262
}
12631263
compileNode = $template[0];
12641264

@@ -1685,7 +1685,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
16851685
if (jqLiteIsTextNode(content)) {
16861686
$template = [];
16871687
} else {
1688-
$template = jqLite(content);
1688+
$template = jqLite(trim(content));
16891689
}
16901690
compileNode = $template[0];
16911691

0 commit comments

Comments
 (0)