fix(ivy): incorrectly remapping certain properties that refer inputs (#28765)

During build time we remap particular property bindings, because their names don't match their attribute equivalents (e.g. the property for the `for` attribute is called `htmlFor`). This breaks down if the particular element has an input that has the same name, because the property gets mapped to something invalid.

The following changes address the issue by mapping the name during runtime, because that's when directives are resolved and we know all of the inputs that are associated with a particular element.

PR Close #28765
This commit is contained in:
Kristiyan Kostadinov
2019-02-15 21:55:07 +01:00
committed by Igor Minar
parent 9defc00b14
commit 93a7836f7a
6 changed files with 95 additions and 14 deletions

View File

@ -242,11 +242,11 @@ class HtmlAstToIvyAst implements html.Visitor {
literal.push(new t.TextAttribute(
prop.name, prop.expression.source || '', prop.sourceSpan, undefined, i18n));
} else {
// we skip validation here, since we do this check at runtime due to the fact that we need
// to make sure a given prop is not an input of some Directive (thus should not be a subject
// of this check) and Directive matching happens at runtime
// Note that validation is skipped and property mapping is disabled
// due to the fact that we need to make sure a given prop is not an
// input of a directive and directive matching happens at runtime.
const bep = this.bindingParser.createBoundElementProperty(
elementName, prop, /* skipValidation */ true);
elementName, prop, /* skipValidation */ true, /* mapPropertyName */ false);
bound.push(t.BoundAttribute.fromBoundElementProperty(bep, i18n));
}
});