optimize: using default parameter
issue: TOBAGO-1633: TS refactoring
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
index d54e0bd..eb1110a 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
@@ -38,7 +38,8 @@
if (change.execute || change.render) {
jsf.ajax.request(
- element.getAttribute("name"),
+ element,
+ // element.getAttribute("name"),
event,
{
"javax.faces.behavior.event": "change",
@@ -76,7 +77,7 @@
if (!command.omit) {
const popup = command.popup;
if (popup && popup.command === "close" && popup.immediate) {
- Popup.close(this);
+ Popup.close(element);
} else {
const action = command.action ? command.action : element.id;
if (command.execute || command.render) {
@@ -93,7 +94,7 @@
Command.submitAction(this, action, command);
}
if (popup && popup.command === "close") {
- Popup.close(this);
+ Popup.close(element);
}
}
}
@@ -141,7 +142,7 @@
static isSubmit: boolean = false;
confirmation: string;
- collapse: boolean;
+ collapse: boolean; // XXX is boolean okay??? Should this be not an element or a structure?
omit: boolean;
popup; // todo: type
action: string;
@@ -243,11 +244,7 @@
}
}
- static init = function (element: HTMLElement) {
- Command.initialize(element, false);
- };
-
- static initialize = function (element: HTMLElement, force: boolean) {
+ static init = function (element: HTMLElement, force: boolean = false) {
for (const commandElement of DomUtils.selfOrQuerySelectorAll(element, "[data-tobago-commands]")) {
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts
index 9b7a905..e9f2ed4 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts
@@ -47,7 +47,7 @@
}
}
- Command.initialize(tabGroup, true);
+ Command.init(tabGroup, true);
}
get tabs(): NodeListOf<Tab> {