Automattic\WooCommerce\Vendor\Pelago\Emogrifier\HtmlProcessor
CssToAttributeConverter::mapMarginProperty
Method of the class: CssToAttributeConverter{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->mapMarginProperty( $node, $value ): void;
- $node(DOMElement) (required)
- node to apply styles to.
- $value(string) (required)
- the value of the style rule to map.
CssToAttributeConverter::mapMarginProperty() CssToAttributeConverter::mapMarginProperty code WC 10.5.0
private function mapMarginProperty(\DOMElement $node, string $value): void
{
if (!$this->isTableOrImageNode($node)) {
return;
}
$margins = $this->parseCssShorthandValue($value);
if ($margins['left'] === 'auto' && $margins['right'] === 'auto') {
$node->setAttribute('align', 'center');
}
}