Ticket #47 (closed defect: invalid)

Opened 23 months ago

Last modified 23 months ago

CSS-selector: "tag1 > tag2" works like "tag1 tag2". Bug in " > " parsing. Simply ">" works fine.

Reported by: cris Owned by: why
Priority: major Milestone:
Component: ext/hpricot_scan Version:
Keywords: css-selector, > Cc:

Description

Tested on last(4.92) version. Css-selector " > " with spaces around it work like simple " ". But in example on page http://code.whytheluckystiff.net/hpricot/wiki/HpricotCssSearch used " > "-version:

doc.search("div.entryPermalink > a").
   prepend("<b>found you on the left</b>").
   append("<b>found you on the right</b>")

My non-working example:

>> doc.search("td[@class='det_l'][@bgcolor='#DADADA'] > img").size
=> 6
>> doc.search("td[@class='det_l'][@bgcolor='#DADADA']>img").size
=> 5
>> doc.search("td[@class='det_l'][@bgcolor='#DADADA'] img").size
=> 6

Change History

Changed 23 months ago by arisbartee

  • status changed from new to closed
  • resolution set to invalid

Your non-working example uses incorrect syntax.

The ">" character is used for CSS searches". Your example is an XPath search. try doc.search("td[@class='det_l',@bgcolor='#DADADA']/img")

Note: See TracTickets for help on using tickets.