Changeset 94
- Timestamp:
- 01/27/2007 11:28:40 (23 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
lib/hpricot/elements.rb (modified) (1 diff)
-
lib/hpricot/parse.rb (modified) (1 diff)
-
lib/hpricot/traverse.rb (modified) (1 diff)
-
test/test_parser.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/hpricot/elements.rb
r89 r94 209 209 210 210 if m[0] == '[' && m[1] =~ /^\d+$/ 211 m = [":", "nth", m[1] ]211 m = [":", "nth", m[1].to_i-1] 212 212 end 213 213 -
trunk/lib/hpricot/parse.rb
r87 r94 119 119 end 120 120 unless matched_elem 121 stack.last[2] << [:bogus_etag, token ]121 stack.last[2] << [:bogus_etag, token.first, token.last] 122 122 else 123 123 ele = stack.pop -
trunk/lib/hpricot/traverse.rb
r92 r94 162 162 end 163 163 p = File.join(parent.xpath, self.pathname) 164 p += "[#{id }]" if sim >= 2164 p += "[#{id+1}]" if sim >= 2 165 165 p 166 166 end -
trunk/test/test_parser.rb
r88 r94 54 54 assert_equal 'link2', (doc/'p').filter('.ohmy').search('a').first.get_attribute('id') 55 55 assert_equal (doc/'p')[2], (doc/'p').filter(':nth(2)')[0] 56 assert_equal (doc/'p')[2], (doc/'p').filter('[ 2]')[0]56 assert_equal (doc/'p')[2], (doc/'p').filter('[3]')[0] 57 57 assert_equal 4, (doc/'p').filter('*').length 58 58 assert_equal 4, (doc/'p').filter('* *').length
