* Generate a form handler unique name and store it in the global form handler list. * This also save that name in the dataset of the given form element. * * @param {HTMLFormElement|null} [formElement=null] * @private
(formElement = null)
| 1440 | * @private |
| 1441 | */ |
| 1442 | _storeFormHandlerFunction(formElement = null) { |
| 1443 | // Create the weakMap if it does not exist |
| 1444 | if (!this.constructor._doesFormHandlerListExists()) { |
| 1445 | this.constructor._createFormHandlerList(); |
| 1446 | } |
| 1447 | |
| 1448 | // Generate a unique name and save it in the form dataset |
| 1449 | const formHandlerName = AutoNumericHelper.randomString(); |
| 1450 | this._getFormElement(formElement).dataset.anFormHandler = formHandlerName; |
| 1451 | |
| 1452 | // Add the form handler name and handle function reference to the WeakMap |
| 1453 | window.aNFormHandlerMap.set(formHandlerName, { submitFn: this._onFormSubmitFunc, resetFn: this._onFormResetFunc }); |
| 1454 | } |
| 1455 | |
| 1456 | /** |
| 1457 | * Return the form handler key name from the parent form element, for the global form handler list. |
no test coverage detected