public function addClass(DOMElement &$element, $class)
    {
        if (empty($class)) {
            return $element;
        }

        // Normalize class
        $class = trim($class);
        if (empty($class)) {
            return $element;
        }

        // Get current class
        $currentClass = trim($this->attr($element, 'class'));

        // Check if class already exists
        $classes = explode(' ', $currentClass);
        if (in_array($class, $classes)) {
            return $element;
        }

        // Append new class
        $this->appendAttr($element, 'class', $class);

        // Return the DOM Element
        return $element;
    }