MCPcopy
hub / github.com/autoNumeric/autoNumeric / _addToLocalList

Method _addToLocalList

src/AutoNumeric.js:3740–3750  ·  view source on GitHub ↗

* Add the given object to the local autoNumeric element list. * Note: in order to keep a coherent list, we only add DOM elements in it, not the autoNumeric object. * * @param {HTMLElement|HTMLInputElement} domElement * @param {AutoNumeric} autoNumericObject A reference to the Aut

(domElement, autoNumericObject = null)

Source from the content-addressed store, hash-verified

3738 * @private
3739 */
3740 _addToLocalList(domElement, autoNumericObject = null) {
3741 if (AutoNumericHelper.isNull(autoNumericObject)) {
3742 autoNumericObject = this;
3743 }
3744
3745 if (!AutoNumericHelper.isUndefined(this.autoNumericLocalList)) {
3746 this.autoNumericLocalList.set(domElement, autoNumericObject); // Use the DOM element as key, and the AutoNumeric object as the value
3747 } else {
3748 AutoNumericHelper.throwError(`The local list provided does not exists when trying to add an element. [${this.autoNumericLocalList}] given.`);
3749 }
3750 }
3751
3752 /**
3753 * Remove the given object from the local autoNumeric element list.

Callers 4

constructorMethod · 0.95
attachMethod · 0.95
initMethod · 0.95
_createLocalListMethod · 0.95

Calls 4

isNullMethod · 0.80
isUndefinedMethod · 0.80
setMethod · 0.80
throwErrorMethod · 0.80

Tested by

no test coverage detected