WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Pelago\Emogrifier\HtmlProcessor

HtmlPruner::removeRedundantClasses() public WC 1.0

Removes classes that are no longer required (e.g. because there are no longer any CSS rules that reference them) from class attributes.

Note that this does not inspect the CSS, but expects to be provided with a list of classes that are still in use.

This method also has the (presumably beneficial) side-effect of minifying (removing superfluous whitespace from) class attributes.

{} Это метод класса: HtmlPruner{}

Хуков нет.

Возвращает

self. fluent interface

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

$HtmlPruner = new HtmlPruner();
$HtmlPruner->removeRedundantClasses( $classesToKeep );
$classesToKeep(массив)
names of classes that should not be removed

Код HtmlPruner::removeRedundantClasses() WC 5.4.1

<?php
public function removeRedundantClasses(array $classesToKeep = [])
{
    $elementsWithClassAttribute = $this->xPath->query('//*[@class]');

    if ($classesToKeep !== []) {
        $this->removeClassesFromElements($elementsWithClassAttribute, $classesToKeep);
    } else {
        // Avoid unnecessary processing if there are no classes to keep.
        $this->removeClassAttributeFromElements($elementsWithClassAttribute);
    }

    return $this;
}