MCPcopy
hub / github.com/autoNumeric/autoNumeric / _checkElement

Method _checkElement

src/AutoNumeric.js:7929–7946  ·  view source on GitHub ↗

* Check if the DOM element is supported by autoNumeric. * A supported element is either an element with the correct 'type' attribute, or a tag whitelisted in the `allowedTagList` array. * If the check fails, this method throws. * This function also sets the info `this.isInputE

()

Source from the content-addressed store, hash-verified

7927 * @private
7928 */
7929 _checkElement() {
7930 const currentElementTag = this.domElement.tagName.toLowerCase();
7931
7932 if (!this._isElementTagSupported()) {
7933 AutoNumericHelper.throwError(`The <${currentElementTag}> tag is not supported by autoNumeric`);
7934 }
7935
7936 if (this._isInputElement()) {
7937 if (!this._isInputTypeSupported()) {
7938 AutoNumericHelper.throwError(`The input type "${this.domElement.type}" is not supported by autoNumeric`);
7939 }
7940
7941 this.isInputElement = true;
7942 } else {
7943 this.isInputElement = false;
7944 this.isContentEditable = this._isContentEditable(this.domElement);
7945 }
7946 }
7947
7948 /**
7949 * Returns `true` if the given DOM element is a contenteditable one (set to `true`)

Callers 1

constructorMethod · 0.95

Calls 5

_isInputElementMethod · 0.95
_isInputTypeSupportedMethod · 0.95
_isContentEditableMethod · 0.95
throwErrorMethod · 0.80

Tested by

no test coverage detected