Ticket #148 (new defect)

Opened 5 months ago

Last modified 5 months ago

e.swap('') causes subsequent elements to be skipped in traverse_element()

Reported by: davidroyalmartin Owned by: why
Priority: major Milestone: 0.6
Component: lib/hpricot Version:
Keywords: Cc:

Description (last modified by davidroyalmartin) (diff)

swap with empty string causes the problem. swap with a space does not. this must be a bug? here is code that exhibits the problem. i'm using hpricot 0.6.

def hpricot_bug_report()
    s = '<!--comment--><a>x</a>'
    doc = Hpricot(s)
    doc.traverse_element do |e|
      if e.elem?
        puts "elem #{e}"
      elsif e.comment?
        puts "comment #{e}"
        e.swap('') # elem not visited
        # e.swap(' ') # elem still visited
      end
    end
  end

Change History

Changed 5 months ago by davidroyalmartin

  • priority changed from minor to major

Changed 5 months ago by davidroyalmartin

  • description modified (diff)
Note: See TracTickets for help on using tickets.