QueryPath\CSS\QueryPathEventHandler::firstOfType PHP Method

firstOfType() protected method

Pseudo-class handler for :first-of-type.
protected firstOfType ( )
    protected function firstOfType()
    {
        $matches = $this->candidateList();
        $found = new \SplObjectStorage();
        foreach ($matches as $item) {
            $type = $item->tagName;
            $parent = $item->parentNode;
            foreach ($parent->childNodes as $kid) {
                if ($kid->nodeType == XML_ELEMENT_NODE && $kid->tagName == $type) {
                    if (!$found->contains($kid)) {
                        $found->attach($kid);
                    }
                    break;
                }
            }
        }
        $this->matches = $found;
    }