MCPcopy
hub / github.com/autoNumeric/autoNumeric / _getContenteditableElements

Method _getContenteditableElements

src/AutoNumeric.js:3155–3163  ·  view source on GitHub ↗

* Returns an array of the non-input contenteditable elements linked to the given form element. * Two types of elements are possible, either located inside the form element, or outside. * For the outside elements, this only works if the form element has a defined id and that id is reference

(formElement)

Source from the content-addressed store, hash-verified

3153 * @private
3154 */
3155 _getContenteditableElements(formElement) {
3156 if (AutoNumericHelper.isUndefinedOrNullOrEmpty(formElement) || !formElement.hasAttribute('id')) {
3157 return [];
3158 }
3159 const elementsInside = [...formElement.querySelectorAll('[contenteditable=true]')];
3160 const elementsOutside = [...document.querySelectorAll(`*:not(input)[form=${formElement.getAttribute('id')}][contenteditable=true]`)];
3161
3162 return AutoNumericHelper.arrayUnique(elementsInside, elementsOutside);
3163 }
3164
3165 /**
3166 * Returns a reference to the parent <form> element if it exists, otherwise return `null`.

Callers 1

Calls 2

arrayUniqueMethod · 0.80

Tested by

no test coverage detected