Method: Hpricot::Container::Trav#get_element_by_id

Defined in:
lib/hpricot/traverse.rb

- (Object) get_element_by_id(id)



522
523
524
525
526
527
528
529
# File 'lib/hpricot/traverse.rb', line 522

def get_element_by_id(id)
  traverse_all_element do |ele|
      if ele.elem? and eid = ele.get_attribute('id')
          return ele if eid.to_s == id
      end
  end
  nil
end

Comments