diff --git a/modules/angular2/src/core/linker/view.ts b/modules/angular2/src/core/linker/view.ts index 20e10fe73bc9d..6574b94b90886 100644 --- a/modules/angular2/src/core/linker/view.ts +++ b/modules/angular2/src/core/linker/view.ts @@ -173,7 +173,7 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher { logBindingUpdate(b: BindingTarget, value: any): void { if (b.isDirective() || b.isElementProperty()) { var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; - this.renderer.setElementAttribute( + this.renderer.setBindingDebugInfo( elementRef, `${REFLECT_PREFIX}${camelCaseToDashCase(b.name)}`, `${value}`); } } diff --git a/modules/angular2/src/core/render/api.ts b/modules/angular2/src/core/render/api.ts index e1ef10e80f00d..30ae01ec642f6 100644 --- a/modules/angular2/src/core/render/api.ts +++ b/modules/angular2/src/core/render/api.ts @@ -300,6 +300,9 @@ export abstract class Renderer { abstract setElementAttribute(location: RenderElementRef, attributeName: string, attributeValue: string); + abstract setBindingDebugInfo(location: RenderElementRef, propertyName: string, + propertyValue: string); + /** * Sets a (CSS) class on the Element specified via `location`. * diff --git a/modules/angular2/src/platform/dom/dom_renderer.ts b/modules/angular2/src/platform/dom/dom_renderer.ts index cf2a74e6a8f2e..693cb0d05eb9f 100644 --- a/modules/angular2/src/platform/dom/dom_renderer.ts +++ b/modules/angular2/src/platform/dom/dom_renderer.ts @@ -1,9 +1,11 @@ import {Inject, Injectable, OpaqueToken} from 'angular2/src/core/di'; import {AnimationBuilder} from 'angular2/src/animate/animation_builder'; +import {StringMapWrapper} from 'angular2/src/facade/collection'; import { isPresent, isBlank, + Json, RegExpWrapper, CONST_EXPR, stringify, @@ -41,11 +43,13 @@ import { import {camelCaseToDashCase} from './util'; import {ViewEncapsulation} from 'angular2/src/core/metadata'; -// TODO move it once DomAdapter is moved +// TODO move it once DdomAdapter is moved import {DOM} from 'angular2/src/platform/dom/dom_adapter'; const NAMESPACE_URIS = CONST_EXPR({'xlink': 'http://www.w3.org/1999/xlink', 'svg': 'http://www.w3.org/2000/svg'}); +const TEMPLATE_COMMENT_TEXT = 'template bindings={}'; +var TEMPLATE_BINDINGS_EXP = /^template bindings=(.*)$/g; export abstract class DomRenderer extends Renderer implements NodeFactory { abstract registerComponentTemplate(template: RenderComponentTemplate); @@ -118,7 +122,7 @@ export abstract class DomRenderer extends Renderer implements NodeFactory dehydrateView(viewRef: RenderViewRef) { resolveInternalDomView(viewRef).dehydrate(); } createTemplateAnchor(attrNameAndValues: string[]): Node { - return this.createElement('script', attrNameAndValues); + return DOM.createComment(TEMPLATE_COMMENT_TEXT); } abstract createElement(name: string, attrNameAndValues: string[]): Node; abstract mergeElement(existing: Node, attrNameAndValues: string[]); @@ -146,6 +150,31 @@ export abstract class DomRenderer extends Renderer implements NodeFactory } } + /** + * Used only in debug mode to serialize property changes to comment nodes, + * such as