diff --git a/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts b/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts index 6a8637b3ca..fcc6d6f141 100644 --- a/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts +++ b/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts @@ -92,8 +92,9 @@ const ALLOW_DEFAULT_VAR = o.variable(`allowDefault`); class ViewBuilder implements TemplateAstVisitor, LocalResolver, BuiltinConverterFactory { private compType: o.Type; private nodeDefs: (() => o.Expression)[] = []; - private purePipeNodeIndices: {[pipeName: string]: number} = {}; - private refNodeIndices: {[refName: string]: number} = {}; + private purePipeNodeIndices: {[pipeName: string]: number} = Object.create(null); + // Need Object.create so that we don't have builtin values... + private refNodeIndices: {[refName: string]: number} = Object.create(null); private variables: VariableAst[] = []; private children: ViewBuilder[] = []; private updateDirectivesExpressions: UpdateExpression[] = []; @@ -929,7 +930,7 @@ function elementBindingDefs( function fixedAttrsDef(elementAst: ElementAst): o.Expression { - const mapResult: {[key: string]: string} = {}; + const mapResult: {[key: string]: string} = Object.create(null); elementAst.attrs.forEach(attrAst => { mapResult[attrAst.name] = attrAst.value; }); elementAst.directives.forEach(dirAst => { Object.keys(dirAst.directive.hostAttributes).forEach(name => { diff --git a/modules/@angular/core/src/view/refs.ts b/modules/@angular/core/src/view/refs.ts index 4b3aa4ac39..d1b15f5494 100644 --- a/modules/@angular/core/src/view/refs.ts +++ b/modules/@angular/core/src/view/refs.ts @@ -232,8 +232,8 @@ export function createTemplateRef(view: ViewData, def: NodeDef): TemplateRef { - constructor(private _parentView: ViewData, private _def: NodeDef) {} +class TemplateRef_ extends TemplateRef { + constructor(private _parentView: ViewData, private _def: NodeDef) { super(); } createEmbeddedView(context: any): EmbeddedViewRef { return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, context)); diff --git a/modules/@angular/core/src/view/services.ts b/modules/@angular/core/src/view/services.ts index f0b4c730a0..c767d3d4c0 100644 --- a/modules/@angular/core/src/view/services.ts +++ b/modules/@angular/core/src/view/services.ts @@ -243,7 +243,12 @@ function debugCheckAndUpdateNode( } else { // a regular element. for (let attr in bindingValues) { - view.renderer.setAttribute(el, attr, bindingValues[attr]); + const value = bindingValues[attr]; + if (value != null) { + view.renderer.setAttribute(el, attr, value); + } else { + view.renderer.removeAttribute(el, attr); + } } } } @@ -270,7 +275,7 @@ function camelCaseToDashCase(input: string): string { function normalizeDebugBindingValue(value: any): string { try { // Limit the size of the value as otherwise the DOM just gets polluted. - return value ? value.toString().slice(0, 20) : value; + return value ? value.toString().slice(0, 30) : value; } catch (e) { return '[ERROR] Exception while trying to serialize the value'; } diff --git a/modules/@angular/core/src/view/util.ts b/modules/@angular/core/src/view/util.ts index b940ac653e..be17704426 100644 --- a/modules/@angular/core/src/view/util.ts +++ b/modules/@angular/core/src/view/util.ts @@ -176,11 +176,10 @@ export function splitMatchedQueriesDsl(matchedQueriesDsl: [string | number, Quer export function getParentRenderElement(view: ViewData, renderHost: any, def: NodeDef): any { let renderParent = def.renderParent; if (renderParent) { - const parent = def.parent; - if (parent && - (parent.type !== NodeType.Element || (parent.flags & NodeFlags.HasComponent) === 0 || - (parent.element.componentRendererType && - parent.element.componentRendererType.encapsulation === ViewEncapsulation.Native))) { + if (renderParent.type !== NodeType.Element || + (renderParent.flags & NodeFlags.HasComponent) === 0 || + (renderParent.element.componentRendererType && + renderParent.element.componentRendererType.encapsulation === ViewEncapsulation.Native)) { // only children of non components, or children of components with native encapsulation should // be attached. return asElementData(view, def.renderParent.index).renderElement;