Automattic\WooCommerce\EmailEditor\Integrations\Utils
Dom_Document_Helper::remove_element
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.
Method of the class: Dom_Document_Helper{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Dom_Document_Helper = new Dom_Document_Helper(); $Dom_Document_Helper->remove_element( $element ): void;
- $element(DOMElement) (required)
- The element to remove.
Dom_Document_Helper::remove_element() Dom Document Helper::remove element code WC 11.1.2
public function remove_element( \DOMElement $element ): void {
$parent = $element->parentNode; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
if ( $parent instanceof \DOMNode ) {
$parent->removeChild( $element );
}
}