protected function filter_selected() { $attr = $this->getAttribute('selected'); if (is_array($attr)) { $attr = reset($attr); } return strcasecmp($attr, 'selected') === 0; }