fix(ivy): validate props and attrs with "on" prefix at runtime (#28054)
Prior to this change we performed prop and attr name validation at compile time, which failed in case a given prop/attr is an input to a Directive (thus should not be a subject to this check). Since Directive matching in Ivy happens at runtime, the corresponding checks are now moved to runtime as well. PR Close #28054
This commit is contained in:
@ -238,8 +238,9 @@ export class BindingParser {
|
||||
}
|
||||
}
|
||||
|
||||
createBoundElementProperty(elementSelector: string, boundProp: ParsedProperty):
|
||||
BoundElementProperty {
|
||||
createBoundElementProperty(
|
||||
elementSelector: string, boundProp: ParsedProperty,
|
||||
skipValidation: boolean = false): BoundElementProperty {
|
||||
if (boundProp.isAnimation) {
|
||||
return new BoundElementProperty(
|
||||
boundProp.name, BindingType.Animation, SecurityContext.NONE, boundProp.expression, null,
|
||||
@ -252,11 +253,13 @@ export class BindingParser {
|
||||
const parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
|
||||
let securityContexts: SecurityContext[] = undefined !;
|
||||
|
||||
// Check check for special cases (prefix style, attr, class)
|
||||
// Check for special cases (prefix style, attr, class)
|
||||
if (parts.length > 1) {
|
||||
if (parts[0] == ATTRIBUTE_PREFIX) {
|
||||
boundPropertyName = parts[1];
|
||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
|
||||
if (!skipValidation) {
|
||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
|
||||
}
|
||||
securityContexts = calcPossibleSecurityContexts(
|
||||
this._schemaRegistry, elementSelector, boundPropertyName, true);
|
||||
|
||||
@ -286,7 +289,9 @@ export class BindingParser {
|
||||
securityContexts = calcPossibleSecurityContexts(
|
||||
this._schemaRegistry, elementSelector, boundPropertyName, false);
|
||||
bindingType = BindingType.Property;
|
||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
|
||||
if (!skipValidation) {
|
||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
|
||||
}
|
||||
}
|
||||
|
||||
return new BoundElementProperty(
|
||||
|
Reference in New Issue
Block a user