Skip to content

Commit

Permalink
fix($compile): fix regression which affected old jQuery releases
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
caitp committed Apr 5, 2014
1 parent 8b0b7ca commit ef64169
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if (jqLiteIsTextNode(directiveValue)) {
$template = [];
} else {
$template = jqLite(directiveValue);
$template = jqLite(trim(directiveValue));
}
compileNode = $template[0];

Expand Down Expand Up @@ -1688,7 +1688,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if (jqLiteIsTextNode(content)) {
$template = [];
} else {
$template = jqLite(content);
$template = jqLite(trim(content));
}
compileNode = $template[0];

Expand Down

0 comments on commit ef64169

Please sign in to comment.