diff --git a/modules/angular2/src/core/change_detection/abstract_change_detector.ts b/modules/angular2/src/core/change_detection/abstract_change_detector.ts index 45141238bb..cf17a65d84 100644 --- a/modules/angular2/src/core/change_detection/abstract_change_detector.ts +++ b/modules/angular2/src/core/change_detection/abstract_change_detector.ts @@ -26,8 +26,8 @@ class _Context { } export class AbstractChangeDetector implements ChangeDetector { - lightDomChildren: any[] = []; - shadowDomChildren: any[] = []; + contentChildren: any[] = []; + viewChildren: any[] = []; parent: ChangeDetector; ref: ChangeDetectorRef; @@ -50,21 +50,21 @@ export class AbstractChangeDetector implements ChangeDetector { this.ref = new ChangeDetectorRef_(this); } - addChild(cd: ChangeDetector): void { - this.lightDomChildren.push(cd); + addContentChild(cd: ChangeDetector): void { + this.contentChildren.push(cd); cd.parent = this; } - removeChild(cd: ChangeDetector): void { ListWrapper.remove(this.lightDomChildren, cd); } + removeContentChild(cd: ChangeDetector): void { ListWrapper.remove(this.contentChildren, cd); } - addShadowDomChild(cd: ChangeDetector): void { - this.shadowDomChildren.push(cd); + addViewChild(cd: ChangeDetector): void { + this.viewChildren.push(cd); cd.parent = this; } - removeShadowDomChild(cd: ChangeDetector): void { ListWrapper.remove(this.shadowDomChildren, cd); } + removeViewChild(cd: ChangeDetector): void { ListWrapper.remove(this.viewChildren, cd); } - remove(): void { this.parent.removeChild(this); } + remove(): void { this.parent.removeContentChild(this); } handleEvent(eventName: string, elIndex: number, locals: Locals): boolean { var res = this.handleEventInternal(eventName, elIndex, locals); @@ -86,10 +86,10 @@ export class AbstractChangeDetector implements ChangeDetector { this.detectChangesInRecords(throwOnChange); - this._detectChangesInLightDomChildren(throwOnChange); + this._detectChangesContentChildren(throwOnChange); if (!throwOnChange) this.afterContentLifecycleCallbacks(); - this._detectChangesInShadowDomChildren(throwOnChange); + this._detectChangesInViewChildren(throwOnChange); if (!throwOnChange) this.afterViewLifecycleCallbacks(); if (this.mode === ChangeDetectionStrategy.CheckOnce) @@ -130,7 +130,7 @@ export class AbstractChangeDetector implements ChangeDetector { // This method is not intended to be overridden. Subclasses should instead provide an // implementation of `hydrateDirectives`. - hydrate(context: T, locals: Locals, directives: any, pipes: any): void { + hydrate(context: T, locals: Locals, directives: any, pipes: Pipes): void { this.mode = ChangeDetectionUtil.changeDetectionMode(this.strategy); this.context = context; @@ -183,16 +183,16 @@ export class AbstractChangeDetector implements ChangeDetector { afterViewLifecycleCallbacksInternal(): void {} /** @internal */ - _detectChangesInLightDomChildren(throwOnChange: boolean): void { - var c = this.lightDomChildren; + _detectChangesContentChildren(throwOnChange: boolean): void { + var c = this.contentChildren; for (var i = 0; i < c.length; ++i) { c[i].runDetectChanges(throwOnChange); } } /** @internal */ - _detectChangesInShadowDomChildren(throwOnChange: boolean): void { - var c = this.shadowDomChildren; + _detectChangesInViewChildren(throwOnChange: boolean): void { + var c = this.viewChildren; for (var i = 0; i < c.length; ++i) { c[i].runDetectChanges(throwOnChange); } diff --git a/modules/angular2/src/core/change_detection/binding_record.ts b/modules/angular2/src/core/change_detection/binding_record.ts index cf7c5ee284..24282b208d 100644 --- a/modules/angular2/src/core/change_detection/binding_record.ts +++ b/modules/angular2/src/core/change_detection/binding_record.ts @@ -47,7 +47,6 @@ export class BindingRecord { return isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); } - static createDirectiveDoCheck(directiveRecord: DirectiveRecord): BindingRecord { return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); } diff --git a/modules/angular2/src/core/change_detection/codegen_name_util.ts b/modules/angular2/src/core/change_detection/codegen_name_util.ts index bef3f362c8..c95b76c9e2 100644 --- a/modules/angular2/src/core/change_detection/codegen_name_util.ts +++ b/modules/angular2/src/core/change_detection/codegen_name_util.ts @@ -23,7 +23,7 @@ export const CONTEXT_ACCESSOR = "context"; export const CONTEXT_INDEX = 0; const _FIELD_PREFIX = 'this.'; -var _whiteSpaceRegExp = RegExpWrapper.create("\\W", "g"); +var _whiteSpaceRegExp = /\W/g; /** * Returns `s` with all non-identifier characters removed. diff --git a/modules/angular2/src/core/change_detection/interfaces.ts b/modules/angular2/src/core/change_detection/interfaces.ts index 6710f42814..7bb0c8c196 100644 --- a/modules/angular2/src/core/change_detection/interfaces.ts +++ b/modules/angular2/src/core/change_detection/interfaces.ts @@ -22,10 +22,10 @@ export interface ChangeDetector { mode: ChangeDetectionStrategy; ref: ChangeDetectorRef; - addChild(cd: ChangeDetector): void; - addShadowDomChild(cd: ChangeDetector): void; - removeChild(cd: ChangeDetector): void; - removeShadowDomChild(cd: ChangeDetector): void; + addContentChild(cd: ChangeDetector): void; + addViewChild(cd: ChangeDetector): void; + removeContentChild(cd: ChangeDetector): void; + removeViewChild(cd: ChangeDetector): void; remove(): void; hydrate(context: any, locals: Locals, directives: any, pipes: any): void; dehydrate(): void; diff --git a/modules/angular2/src/core/linker/view_manager_utils.ts b/modules/angular2/src/core/linker/view_manager_utils.ts index a0d419aee1..7cb03cf163 100644 --- a/modules/angular2/src/core/linker/view_manager_utils.ts +++ b/modules/angular2/src/core/linker/view_manager_utils.ts @@ -102,7 +102,7 @@ export class AppViewManagerUtils { currentView.init(protoView.changeDetectorFactory(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); if (isPresent(parentView) && protoView.type === viewModule.ViewType.COMPONENT) { - parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + parentView.changeDetector.addViewChild(currentView.changeDetector); } elementOffset += protoView.elementBinders.length; textOffset += protoView.textBindingCount; @@ -122,7 +122,7 @@ export class AppViewManagerUtils { contextView = parentView; contextBoundElementIndex = boundElementIndex; } - parentView.changeDetector.addChild(view.changeDetector); + parentView.changeDetector.addContentChild(view.changeDetector); var viewContainer = parentView.viewContainers[boundElementIndex]; if (isBlank(viewContainer)) { viewContainer = new viewModule.AppViewContainer(); diff --git a/modules/angular2/test/core/change_detection/change_detector_spec.ts b/modules/angular2/test/core/change_detection/change_detector_spec.ts index c72098c79d..a516c17677 100644 --- a/modules/angular2/test/core/change_detection/change_detector_spec.ts +++ b/modules/angular2/test/core/change_detection/change_detector_spec.ts @@ -634,7 +634,7 @@ export function main() { it('should be called before processing view children', () => { var parent = _createWithoutHydrate('directNoDispatcher').changeDetector; var child = _createWithoutHydrate('directNoDispatcher').changeDetector; - parent.addShadowDomChild(child); + parent.addViewChild(child); var orderOfOperations = []; @@ -753,7 +753,7 @@ export function main() { it('should be called after processing view children', () => { var parent = _createWithoutHydrate('directNoDispatcher').changeDetector; var child = _createWithoutHydrate('directNoDispatcher').changeDetector; - parent.addShadowDomChild(child); + parent.addViewChild(child); var orderOfOperations = []; @@ -902,32 +902,32 @@ export function main() { child = _createChangeDetector('"str"').changeDetector; }); - it('should add light dom children', () => { - parent.addChild(child); + it('should add content children', () => { + parent.addContentChild(child); - expect(parent.lightDomChildren.length).toEqual(1); - expect(parent.lightDomChildren[0]).toBe(child); + expect(parent.contentChildren.length).toEqual(1); + expect(parent.contentChildren[0]).toBe(child); }); - it('should add shadow dom children', () => { - parent.addShadowDomChild(child); + it('should add view children', () => { + parent.addViewChild(child); - expect(parent.shadowDomChildren.length).toEqual(1); - expect(parent.shadowDomChildren[0]).toBe(child); + expect(parent.viewChildren.length).toEqual(1); + expect(parent.viewChildren[0]).toBe(child); }); - it('should remove light dom children', () => { - parent.addChild(child); - parent.removeChild(child); + it('should remove content children', () => { + parent.addContentChild(child); + parent.removeContentChild(child); - expect(parent.lightDomChildren).toEqual([]); + expect(parent.contentChildren).toEqual([]); }); - it('should remove shadow dom children', () => { - parent.addShadowDomChild(child); - parent.removeShadowDomChild(child); + it('should remove view children', () => { + parent.addViewChild(child); + parent.removeViewChild(child); - expect(parent.shadowDomChildren.length).toEqual(0); + expect(parent.viewChildren.length).toEqual(0); }); }); @@ -1142,7 +1142,7 @@ export function main() { function changeDetector(mode, parent) { var val = _createChangeDetector('10'); val.changeDetector.mode = mode; - if (isPresent(parent)) parent.addChild(val.changeDetector); + if (isPresent(parent)) parent.addContentChild(val.changeDetector); return val.changeDetector; } diff --git a/modules/benchmarks/src/change_detection/change_detection_benchmark.ts b/modules/benchmarks/src/change_detection/change_detection_benchmark.ts index ceea3253e9..d62838f317 100644 --- a/modules/benchmarks/src/change_detection/change_detection_benchmark.ts +++ b/modules/benchmarks/src/change_detection/change_detection_benchmark.ts @@ -285,7 +285,7 @@ function setUpChangeDetection(protoChangeDetectorFactory: Function, iterations, for (var i = 0; i < iterations; ++i) { var cd = proto.instantiate(dispatcher); cd.hydrate(object, null, new FakeDirectives(targetObj), null); - parentCd.addChild(cd); + parentCd.addContentChild(cd); } return parentCd; }