feat(change_detection): ensure that expression do not change after they have been checked
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {Injector, bind, OpaqueToken} from 'di/di';
|
||||
import {Type, FIELD, isBlank, isPresent, BaseException} from 'facade/lang';
|
||||
import {Type, FIELD, isBlank, isPresent, BaseException, assertionsEnabled} from 'facade/lang';
|
||||
import {DOM, Element} from 'facade/dom';
|
||||
import {Compiler, CompilerCache} from './compiler/compiler';
|
||||
import {ProtoView} from './compiler/view';
|
||||
@ -63,7 +63,7 @@ export function documentDependentBindings(appComponentType) {
|
||||
bind(appRecordRangeToken).toFactory((rootView) => rootView.recordRange,
|
||||
[appViewToken]),
|
||||
bind(ChangeDetector).toFactory((appRecordRange) =>
|
||||
new ChangeDetector(appRecordRange), [appRecordRangeToken]),
|
||||
new ChangeDetector(appRecordRange, assertionsEnabled()), [appRecordRangeToken]),
|
||||
bind(appComponentType).toFactory((rootView) => rootView.elementInjectors[0].getComponent(),
|
||||
[appViewToken])
|
||||
];
|
||||
|
@ -68,19 +68,19 @@ export class ElementBinderBuilder extends CompileStep {
|
||||
|
||||
_bindTextNodes(protoView, compileElement) {
|
||||
MapWrapper.forEach(compileElement.textNodeBindings, (expression, indexInParent) => {
|
||||
protoView.bindTextNode(indexInParent, expression.ast);
|
||||
protoView.bindTextNode(indexInParent, expression);
|
||||
});
|
||||
}
|
||||
|
||||
_bindElementProperties(protoView, compileElement) {
|
||||
MapWrapper.forEach(compileElement.propertyBindings, (expression, property) => {
|
||||
protoView.bindElementProperty(property, expression.ast);
|
||||
protoView.bindElementProperty(property, expression);
|
||||
});
|
||||
}
|
||||
|
||||
_bindEvents(protoView, compileElement) {
|
||||
MapWrapper.forEach(compileElement.eventBindings, (expression, eventName) => {
|
||||
protoView.bindEvent(eventName, expression.ast);
|
||||
protoView.bindEvent(eventName, expression);
|
||||
});
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ export class ElementBinderBuilder extends CompileStep {
|
||||
}
|
||||
protoView.bindDirectiveProperty(
|
||||
directiveIndex++,
|
||||
expression.ast,
|
||||
expression,
|
||||
dirProp,
|
||||
reflector.setter(dirProp)
|
||||
);
|
||||
|
Reference in New Issue
Block a user