public function removeClass(DOMElement &$element, $class)
    {
        // Get current class
        $currentClass = trim($this->attr($element, 'class'));

        // Check if class doesn't exists
        $classes = explode(' ', $currentClass);
        $classKey = array_search($class, $classes);
        if ($classKey === false) {
            return $element;
        }

        // Remove class and set new class attribute
        unset($classes[$classKey]);
        $newClass = implode(' ', $classes);

        // Update attribute
        $this->attr($element, 'class', empty($newClass) ? null : $newClass);

        // Return the HTML element
        return $element;
    }