Skip to content

Commit

Permalink
feat(renderer): use a comment instead of an element when stamping out…
Browse files Browse the repository at this point in the history
… template>` elements

Originally authored by @tbosch, this reverts the revert commit
e274ff8.

Closes angular#4805
  • Loading branch information
jeffbcross authored and vsavkin committed Dec 10, 2015
1 parent 3c44398 commit f2a8f0f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var _allViewsById = new Map<number, AppView>();
var _nextId = 0;

function _setElementId(element, indices: number[]) {
if (isPresent(element)) {
if (isPresent(element) && DOM.isElementNode(element)) {
DOM.setData(element, NG_ID_PROPERTY, indices.join(NG_ID_SEPARATOR));
}
}
Expand Down
13 changes: 13 additions & 0 deletions modules/angular2/test/core/linker/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,19 @@ export function main() {
});
}));

it('should use a comment while stamping out `<template>` elements.',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({template: '<template></template>'}))

.createAsync(MyComp)
.then((fixture) => {
var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement);
expect(childNodesOfWrapper.length).toBe(1);
expect(DOM.isCommentNode(childNodesOfWrapper[0])).toBe(true);
async.done();
});
}));

it('should support template directives via `template` attribute.',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
Expand Down
2 changes: 1 addition & 1 deletion modules/benchmarks/e2e_test/naive_infinite_scroll_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('ng2 naive infinite scroll benchmark', function() {
it('should not throw errors', function() {
browser.get(URL);
var expectedRowCount = 18;
var expectedCellsPerRow = 28;
var expectedCellsPerRow = 27;
var allScrollItems = 'scroll-app #testArea scroll-item';
var cells = `${ allScrollItems } .row *`;
var stageButtons = `${ allScrollItems } .row stage-buttons button`;
Expand Down

0 comments on commit f2a8f0f

Please sign in to comment.