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

Commit

Permalink
refactor($compile): code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Aug 13, 2012
1 parent e85774f commit 0f37194
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,14 +576,16 @@ function $CompileProvider($provide) {
}
}

if (directiveValue = directive.template) {
if ((directiveValue = directive.template)) {
assertNoDuplicate('template', templateDirective, directive, $compileNode);
templateDirective = directive;

$template = jqLite('<div>' + trim(directiveValue) + '</div>').contents();
compileNode = $template[0];

if (directive.replace) {
$template = jqLite('<div>' +
trim(directiveValue) +
'</div>').contents();
compileNode = $template[0];

if ($template.length != 1 || compileNode.nodeType !== 1) {
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue);
}
Expand Down
3 changes: 1 addition & 2 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ describe('$compile', function() {

describe('template', function() {


beforeEach(module(function() {
directive('replace', valueFn({
restrict: 'CAM',
Expand All @@ -394,7 +393,7 @@ describe('$compile', function() {
compile: function(element, attr) {
attr.$set('compiled', 'COMPILED');
expect(element).toBe(attr.$$element);
}
}
}));
}));

Expand Down

0 comments on commit 0f37194

Please sign in to comment.