protected function applyStyles($element)
    {
        if ( ! $this->style) return $element;

        if (array_key_exists('class', $element['attributes'])) {
            $classes = explode(' ', $element['attributes']['class']);
            $element = $this->applyStylesToElement($element, $this->style->getByClasses($classes));
        }

        if (array_key_exists('id', $element['attributes'])) {
            $element = $this->applyStylesToElement($element, $this->style->getById($element['attributes']['id']));
        }

        $element = $this->applyStylesToElement($element, $this->style->getByElement($element['name']));

        return $element;
    }