diff --git a/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts b/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts index 5347fa90d3..ccd983937d 100644 --- a/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts +++ b/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts @@ -271,23 +271,21 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry { } hasProperty(tagName: string, propName: string, schemaMetas: SchemaMetadata[]): boolean { - const hasCustomElementSchema = - schemaMetas.some((schema) => schema.name === CUSTOM_ELEMENTS_SCHEMA.name); if (tagName.indexOf('-') !== -1) { if (tagName === 'ng-container' || tagName === 'ng-content') { return false; } - - // Can't tell now as we don't know which properties a custom element will get - // once it is instantiated - return hasCustomElementSchema; - } else { - var elementProperties = this.schema[tagName.toLowerCase()]; - if (!isPresent(elementProperties)) { - elementProperties = this.schema['unknown']; + if (schemaMetas.some((schema) => schema.name === CUSTOM_ELEMENTS_SCHEMA.name)) { + // Can't tell now as we don't know which properties a custom element will get + // once it is instantiated + return true; } - return isPresent(elementProperties[propName]); } + var elementProperties = this.schema[tagName.toLowerCase()]; + if (!isPresent(elementProperties)) { + elementProperties = this.schema['unknown']; + } + return isPresent(elementProperties[propName]); } /** diff --git a/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts b/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts index 293df6daf6..3efe5e4709 100644 --- a/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts +++ b/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts @@ -47,8 +47,12 @@ export function main() { expect(registry.hasProperty('video', 'click', [])).toBeFalsy(); }); - it('should return false for custom-like elements by default', - () => { expect(registry.hasProperty('custom-like', 'unknown', [])).toBe(false); }); + it('should treat custom elements as an unknown element by default', () => { + expect(registry.hasProperty('custom-like', 'unknown', [])).toBe(false); + expect(registry.hasProperty('custom-like', 'className', [])).toBeTruthy(); + expect(registry.hasProperty('custom-like', 'style', [])).toBeTruthy(); + expect(registry.hasProperty('custom-like', 'id', [])).toBeTruthy(); + }); it('should return true for custom-like elements if the CUSTOM_ELEMENTS_SCHEMA was used', () => { expect(registry.hasProperty('custom-like', 'unknown', [CUSTOM_ELEMENTS_SCHEMA])).toBeTruthy();