-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Event binding in XML Templates #559
base: main
Are you sure you want to change the base?
Conversation
Can you also add a fixture for the |
src/linter/xmlTemplate/Parser.ts
Outdated
// We need to parse and lint these as well | ||
const bindingInfo = | ||
this.#bindingLinter.lintPropertyBinding(prop.value, this.#requireDeclarations, position); | ||
if (bindingInfo && prop.value.startsWith("{") && prop.value.endsWith("}")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A composite binding is a valid binding but doesn't necessarily start or end with curly brackets, e.g. .event{field>Value/$Path}Handler
.
AFAICS the bindingInfo will not be an object if there is no binding, so it is already sufficient to check for that.
Also see my changes in #533 which set the bUnescape
argument to false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, check the new solution. It verifies if the potential function name is a valid JS identifier.
The pattern is a bit enhanced to support the all the variants of using functions in XML.
Source:
ui5-linter/src/linter/html/transpiler.ts
Line 329 in 3abcf56
const validFunctionName = /^[$_\p{ID_Start}][$_\p{ID_Continue}]*$/u; |
4cc917e
to
a1e5c13
Compare
a1e5c13
to
9b6ab91
Compare
Please add new cases which previously caused false-positive findings to |
9b6ab91
to
241cb94
Compare
There seem to be problems with parsing certain bindings which are working fine at runtime, but can't be parsed in here: This causes a parsing error |
1578fc9
to
ccdc865
Compare
Will be done in a separate PR
In XML templating it's possible to provide bindings fоr every attribute no matter if it's property, aggregation, event, etc.
Therefore, the linter needs to analyze the bindings within events as "normal" bindings and not just like events.