Automattic\WooCommerce\Vendor\Pelago\Emogrifier

CssInliner::normalizeStyleAttributesOfAllNodesprivateWC 1.0

Parses the document and normalizes all existing CSS attributes. This changes 'DISPLAY: none' to 'display: none'. We wouldn't have to do this if DOMXPath supported XPath 2.0. Also stores a reference of nodes with existing inline styles so we don't overwrite them.

Method of the class: CssInliner{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->normalizeStyleAttributesOfAllNodes(): void;

CssInliner::normalizeStyleAttributesOfAllNodes() code WC 10.5.0

private function normalizeStyleAttributesOfAllNodes(): void
{
    /** @var \DOMElement $node */
    foreach ($this->getAllNodesWithStyleAttribute() as $node) {
        if ($this->isInlineStyleAttributesParsingEnabled) {
            $this->normalizeStyleAttributes($node);
        }
        // Remove style attribute in every case, so we can add them back (if inline style attributes
        // parsing is enabled) to the end of the style list, thus keeping the right priority of CSS rules;
        // else original inline style rules may remain at the beginning of the final inline style definition
        // of a node, which may give not the desired results
        $node->removeAttribute('style');
    }
}