MCPcopy
hub / github.com/autoNumeric/autoNumeric / _createGlobalList

Method _createGlobalList

src/AutoNumeric.js:3595–3600  ·  view source on GitHub ↗

* Create a list of all the AutoNumeric elements that are initialized on the current page. * This is needed in order to determine if a given dom element is already managed by autoNumeric. * This uses a WeakMap in order to limit potential garbage collection problems. * (cf. my tests on

()

Source from the content-addressed store, hash-verified

3593 * @private
3594 */
3595 static _createGlobalList() {
3596 // The check that this global list does not exist already is done in the add and remove functions already
3597 this.autoNumericGlobalListName = 'autoNumericGlobalList'; //XXX This looks weird to set a variable on `this.` in a static method, but that really declare that variable like a static property
3598 // Note: I should not get any memory leaks for referencing the DOM element in the `value`, this DOM element also being the `key`, according to the spec : http://www.ecma-international.org/ecma-262/6.0/#sec-weakmap-objects
3599 this._createWeakMap(this.autoNumericGlobalListName);
3600 }
3601
3602 /**
3603 * Return `true` if the global AutoNumeric element list exists.

Callers 1

_addToGlobalListMethod · 0.95

Calls 1

_createWeakMapMethod · 0.95

Tested by

no test coverage detected