Automattic\WooCommerce\EmailEditor\Integrations\Utils

Html_Processing_Helper::remove_wrapper_handled_classes │ public static │ WC 1.0

Remove from an element the class names whose styles the renderer applies to the wrapping table cell.

Background and border classes are resolved by the CSS inliner wherever they appear. The wrapping cell keeps the block's original class list and receives the same styles inline, so leaving these classes on the inner element paints them a second time. For an opaque color that is invisible, but a translucent palette color composites over itself and renders as a visibly darker band inside the cell's padding.

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

Хуков нет.

Возвращает

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

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

$result = Html_Processing_Helper::remove_wrapper_handled_classes( $html ): void;
$html(WP_HTML_Tag_Processor) (обязательный)
Tag processor positioned on the element to clean.

Код Html_Processing_Helper::remove_wrapper_handled_classes() WC 11.2.2

public static function remove_wrapper_handled_classes( \WP_HTML_Tag_Processor $html ): void {
	$class_attribute = $html->get_attribute( 'class' );
	if ( ! is_string( $class_attribute ) ) {
		return;
	}

	$class_names = preg_split( '/\s+/', trim( $class_attribute ) );
	if ( ! is_array( $class_names ) ) {
		return;
	}

	// Whole class names are compared and removed, so a class that merely contains one of these
	// names as a substring is left intact instead of being reduced to a fragment.
	foreach ( $class_names as $class_name ) {
		if ( '' !== $class_name && self::is_wrapper_handled_class( $class_name ) ) {
			$html->remove_class( $class_name );
		}
	}
}