/**
  * Gets the elements that matches the factor.
  *
  * @param DOMElement $node DOMElement object
  *
  * @return array of DOMElement
  */
 public function filter($node)
 {
     $ret = array();
     $items = $this->_combinator->filter($node, $this->_element->getTagName());
     // filters items by element
     foreach ($items as $item) {
         if ($this->_element->match($item)) {
             array_push($ret, $item);
         }
     }
     // filter items by element filters
     $filters = $this->_element->getFilters();
     foreach ($filters as $filter) {
         $items = array();
         foreach ($ret as $i => $item) {
             if ($filter->match($item, $i, $ret)) {
                 array_push($items, $item);
             }
         }
         $ret = $items;
     }
     return $ret;
 }
 /**
  * Is the next thing an element?
  *
  * The following example is an element:
  * ```
  * div.my-class[title = hello]:nth-child(1)
  * ```
  *
  * In the above example, 'div' is the tag name
  * and the following strings are filters:
  * ```
  * .my-class       // a class filter
  * [title = hello] // an attribute filter
  * :nth-child(1)   // a pseudo filter
  * ```
  *
  * @return false|CssParserModelElement
  */
 protected function element()
 {
     $element = null;
     $filter = null;
     $tagName = "*";
     // ignores left spaces
     $this->match("\\s+");
     if ((list($name) = $this->eq("*")) || (list($name) = $this->is("identifier"))) {
         $tagName = $name ? $name : "*";
     } elseif (!($filter = $this->is("filter"))) {
         return false;
     }
     $element = new CssParserModelElement($tagName);
     // first filter
     if ($filter) {
         $element->addFilter($filter);
     }
     // additional filters
     while ($filter = $this->is("filter")) {
         $element->addFilter($filter);
     }
     return $element;
 }