public function index($selector=null)
    {
        if ($selector === null) {
            if ($node = $this->getFirstElmNode()) {
                $position = 0;
                while ($node && ($node = $node->previousSibling)) {
                    if ($node instanceof \DOMElement) {
                        $position++;
                    } else {
                        break;
                    }
                }
                return $position;
            }
        } else {
            foreach ($this as $key => $node) {
                if ($node->is($selector)) {
                    return $key;
                }
            }
        }

        return -1;
    }