private function parseAttribute(string $html) : string
    {
        $remainingHtml = ltrim($html);

        try {
            // Will match the first entire name/value attribute pair.
            preg_match(
                "/((([a-z0-9\-_]+:)?[a-z0-9\-_]+)(\s*=\s*)?)/i",
                $remainingHtml,
                $attributeMatches
            );

            $attributeName = $attributeMatches[2];
            $remainingHtml = mb_substr(mb_strstr($remainingHtml, $attributeName), mb_strlen($attributeName));
            if ($this->isAttributeValueless($remainingHtml)) {
                $this->attributes[trim($attributeName)] = true;

                return $remainingHtml;
            }

            return $this->parseAttributeValue($html, $remainingHtml, $attributeName);
        } catch (ParseException $e) {
            if ($this->getThrowOnError()) {
                throw $e;
            }
        }

        return '';
    }