protected function htmlAttribs($attribs)
    {
        $html           = '';
        $escapeHtml     = $this->getView()->plugin('escapehtml');
        $escapeHtmlAttr = $this->getView()->plugin('escapehtmlattr');

        foreach ((array) $attribs as $key => $value) {
            $key = $escapeHtml($key);
            $this->cleanHtmlAttribValue($key, $value);
            if (!$value) {
                continue;
            }

            switch ($key) {
                case 'class':
                case 'href':
                    $value = $escapeHtml($value);
                    break;
                default:
                    $value = $escapeHtmlAttr($value);
                    break;
            }

            if ('id' == $key) {
                $value = $this->normalizeId($value);
            }
            
            $html .= $this->getKeyValuePair($key, $value);
        }

        return $html;
    }