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

Commit ef64169

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 8b0b7ca commit ef64169

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
@@ -1261,7 +1261,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
12611261
if (jqLiteIsTextNode(directiveValue)) {
12621262
$template = [];
12631263
} else {
1264-
$template = jqLite(directiveValue);
1264+
$template = jqLite(trim(directiveValue));
12651265
}
12661266
compileNode = $template[0];
12671267

@@ -1688,7 +1688,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
16881688
if (jqLiteIsTextNode(content)) {
16891689
$template = [];
16901690
} else {
1691-
$template = jqLite(content);
1691+
$template = jqLite(trim(content));
16921692
}
16931693
compileNode = $template[0];
16941694

0 commit comments

Comments
 (0)