diff --git a/src/XmlScope.spec.ts b/src/XmlScope.spec.ts
index 61cf23b9c..a8141c609 100644
--- a/src/XmlScope.spec.ts
+++ b/src/XmlScope.spec.ts
@@ -103,6 +103,7 @@ describe('XmlScope', () => {
+
@@ -127,6 +128,9 @@ describe('XmlScope', () => {
range: Range.create(7, 9, 7, 17)
}, { // syntax error expecting '=' but found '/>'
code: DiagnosticMessages.xmlGenericParseError('').code
+ }, { // onChange function
+ ...DiagnosticMessages.xmlFunctionNotFound('func4'),
+ range: Range.create(8, 51, 8, 56)
}]);
});
diff --git a/src/XmlScope.ts b/src/XmlScope.ts
index 8fcb68dfe..bd9efa627 100644
--- a/src/XmlScope.ts
+++ b/src/XmlScope.ts
@@ -71,7 +71,7 @@ export class XmlScope extends Scope {
}
//validate fields
for (const field of api.fields) {
- const { id, type } = field;
+ const { id, type, onChange } = field;
if (!id) {
this.diagnosticMissingAttribute(field, 'id');
}
@@ -86,6 +86,15 @@ export class XmlScope extends Scope {
file: this.xmlFile
});
}
+ if (onChange) {
+ if (!callableContainerMap.has(onChange.toLowerCase())) {
+ this.diagnostics.push({
+ ...DiagnosticMessages.xmlFunctionNotFound(onChange),
+ range: field.getAttribute('onchange').value.range,
+ file: this.xmlFile
+ });
+ }
+ }
}
}
diff --git a/src/parser/SGTypes.ts b/src/parser/SGTypes.ts
index e9ea1b7e4..07d960bcf 100644
--- a/src/parser/SGTypes.ts
+++ b/src/parser/SGTypes.ts
@@ -39,7 +39,7 @@ export class SGTag {
}
getAttributeValue(name: string): string | undefined {
- return this.getAttribute(name)?.value?.text;
+ return this.getAttribute(name.toLowerCase())?.value?.text;
}
setAttribute(name: string, value: string) {