protected function elements($code)
    {
        libxml_use_internal_errors(true);

        $doc = new \DOMDocument;

        $doc->loadHTML((string) $code);

        $tag = (string) $this->tagname;

        $items = $doc->getElementsByTagName($tag);

        $items = iterator_to_array($items);

        return count($items) > 0 ? $items : array();
    }