protected function indexElement(HTML_Element $element) { try { $property = $this->_property; $pval = $element->{$property}; if ($pval !== null) { if (array_key_exists($pval, $this->_index)) { $this->_unique = false; if ($this->_require_unique) { throw new HTML_Duplicate_Attribute_Exception($property, $pval); } $this->_index[$pval][] = $element; } else { $this->_index[$pval] = array($element); } } } catch (HTML_No_Such_Element_Attribute_Exception $e) { } if ($element instanceof HTML_Container) { $sub_elements = $element->getContents(); foreach ($sub_elements as $sub_element) { $this->indexElement($sub_element); } } }