fix(core): prevent unknown property check for AOT-compiled components (#36072)
Prior to this commit, the unknown property check was unnecessarily invoked for AOT-compiled components (for these components, the check happens at compile time). This commit updates the code to avoid unknown property verification for AOT-compiled components by checking whether schemas information is present (as a way to detect whether this is JIT or AOT compiled component). Resolves #35945. PR Close #36072
This commit is contained in:
@ -1038,6 +1038,12 @@ export function setNgReflectProperties(
|
||||
function validateProperty(
|
||||
tView: TView, lView: LView, element: RElement|RComment, propName: string,
|
||||
tNode: TNode): boolean {
|
||||
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
||||
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
||||
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
||||
// execute the check below.
|
||||
if (tView.schemas === null) return true;
|
||||
|
||||
// The property is considered valid if the element matches the schema, it exists on the element
|
||||
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
||||
if (matchingSchemas(tView, lView, tNode.tagName) || propName in element ||
|
||||
|
Reference in New Issue
Block a user