_sanitizeElements = function _sanitizeElements(currentNode) {
		let content;
		/* Execute a hook if present */

		_executeHook('beforeSanitizeElements', currentNode, null);
		/* Check if element is clobbered or can clobber */


		if (_isClobbered(currentNode)) {
			_forceRemove(currentNode);

			return true;
		}
		/* Now let's check the element's type and name */


		const tagName = transformCaseFunc(currentNode.nodeName);
		/* Execute a hook if present */

		_executeHook('uponSanitizeElement', currentNode, {
			tagName,
			allowedTags: ALLOWED_TAGS
		});
		/* Detect mXSS attempts abusing namespace confusion */


		if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
			_forceRemove(currentNode);

			return true;
		}
		/* Remove element if anything forbids its presence */


		if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
			/* Check if we have a custom element to handle */
			if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
				if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
				if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
			}
			/* Keep content except for bad-listed elements */


			if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
				const parentNode = getParentNode(currentNode) || currentNode.parentNode;
				const childNodes = getChildNodes(currentNode) || currentNode.childNodes;

				if (childNodes && parentNode) {
					const childCount = childNodes.length;

					for (let i = childCount - 1; i >= 0; --i) {
						parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
					}
				}
			}

			_forceRemove(currentNode);

			return true;
		}
		/* Check whether element has a valid namespace */


		if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
			_forceRemove(currentNode);

			return true;
		}
		/* Make sure that older browsers don't get fallback-tag mXSS */


		if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
			_forceRemove(currentNode);

			return true;
		}
		/* Sanitize element content to be template-safe */


		if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
			/* Get the element's text content */
			content = currentNode.textContent;
			content = stringReplace(content, MUSTACHE_EXPR, ' ');
			content = stringReplace(content, ERB_EXPR, ' ');
			content = stringReplace(content, TMPLIT_EXPR, ' ');

			if (currentNode.textContent !== content) {
				arrayPush(DOMPurify.removed, {
					element: currentNode.cloneNode()
				});
				currentNode.textContent = content;
			}
		}
		/* Execute a hook if present */


		_executeHook('afterSanitizeElements', currentNode, null);

		return false;
	}
_sanitizeElements

@protect nodeName
@protect textContent
@protect removeChild

@param   {Node} currentNode to check for permission to exist
@return  {Boolean} true if node was killed, false if left alive