fix(compiler): treat custom elements as unknown elements by default

Closes #10300
This commit is contained in:
Tobias Bosch
2016-07-26 11:25:38 -07:00
parent 482c019199
commit fc83bbbe98
2 changed files with 15 additions and 13 deletions

View File

@ -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]);
}
/**