fix(render): allow to configure when templates are serialized to strings
Introduces the injectable `TemplateCloner` that can be configured via the new token `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN`. Also replaces `document.adoptNode` with `document.importNode` as otherwise custom elements are not triggered in chrome 43. Closes #3418 Closes #3433
This commit is contained in:
@ -31,11 +31,10 @@ import {ViewLoader, TemplateAndStyles} from 'angular2/src/render/dom/compiler/vi
|
||||
|
||||
import {resolveInternalDomProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||
import {SharedStylesHost} from 'angular2/src/render/dom/view/shared_styles_host';
|
||||
import {TemplateCloner} from 'angular2/src/render/dom/template_cloner';
|
||||
|
||||
import {MockStep} from './pipeline_spec';
|
||||
|
||||
import {ReferenceCloneableTemplate} from 'angular2/src/render/dom/util';
|
||||
|
||||
export function runCompilerCommonTests() {
|
||||
describe('DomCompiler', function() {
|
||||
var mockStepFactory: MockStepFactory;
|
||||
@ -51,8 +50,8 @@ export function runCompilerCommonTests() {
|
||||
var tplLoader = new FakeViewLoader(urlData);
|
||||
mockStepFactory =
|
||||
new MockStepFactory([new MockStep(processElementClosure, processStyleClosure)]);
|
||||
return new DomCompiler(new ElementSchemaRegistry(), mockStepFactory, tplLoader,
|
||||
sharedStylesHost);
|
||||
return new DomCompiler(new ElementSchemaRegistry(), new TemplateCloner(-1), mockStepFactory,
|
||||
tplLoader, sharedStylesHost);
|
||||
}
|
||||
|
||||
describe('compile', () => {
|
||||
@ -255,9 +254,9 @@ export function runCompilerCommonTests() {
|
||||
});
|
||||
}
|
||||
|
||||
function templateRoot(protoViewDto: ProtoViewDto) {
|
||||
function templateRoot(protoViewDto: ProtoViewDto): Element {
|
||||
var pv = resolveInternalDomProtoView(protoViewDto.render);
|
||||
return (<ReferenceCloneableTemplate>pv.cloneableTemplate).templateRoot;
|
||||
return (<Element>pv.cloneableTemplate);
|
||||
}
|
||||
|
||||
class MockStepFactory extends CompileStepFactory {
|
||||
|
Reference in New Issue
Block a user