Automattic\WooCommerce\EmailEditor\Integrations\Utils

Dom_Document_Helper::remove_element │ public │ WC 1.0

Removes the given element from the document.

A no-op when the element has already been detached (its parent is null), so removing the same node twice — e.g. two images sharing one wrapper — is safe.

Метод класса: Dom_Document_Helper{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Dom_Document_Helper = new Dom_Document_Helper();
$Dom_Document_Helper->remove_element( $element ): void;
$element(DOMElement) (обязательный)
The element to remove.

Код Dom_Document_Helper::remove_element() WC 11.2.2

public function remove_element( \DOMElement $element ): void {
	$parent = $element->parentNode; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
	if ( $parent instanceof \DOMNode ) {
		$parent->removeChild( $element );
	}
}