MCPcopy Index your code
hub / github.com/autoNumeric/autoNumeric / _storeFormHandlerFunction

Method _storeFormHandlerFunction

src/AutoNumeric.js:1442–1454  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 2

_setupFormListenerMethod · 0.95
formMethod · 0.95

Calls 5

_getFormElementMethod · 0.95
randomStringMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected