Automattic\WooCommerce\EmailEditor\Integrations\Utils
Html_Processing_Helper::remove_wrapper_handled_classes
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.
Method of the class: Html_Processing_Helper{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = Html_Processing_Helper::remove_wrapper_handled_classes( $html ): void;
- $html(WP_HTML_Tag_Processor) (required)
- Tag processor positioned on the element to clean.
Html_Processing_Helper::remove_wrapper_handled_classes() Html Processing Helper::remove wrapper handled classes code WC 11.2.1
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 );
}
}
}