Ticket #120 (new defect)

Opened 11 months ago

0.6 changes how modification is done but I can't tell if its a mistake or just undocumented

Reported by: jmhodges Owned by: why
Priority: minor Milestone:
Component: lib/hpricot Version:
Keywords: Cc:

Description

After upgrading to 0.6, I discovered that the way to modify attributes on a tag had changed.

So that instead of:

html = "<div>Example <a href=\"test\">test</a></div>"
h = Hpricot(html)
(h/'a').each{|e| e.attributes['href'] = "foo" }
h.to_html # => "<div>Example <a href=\"foo\">test</a></div>"

we now have to use:

(h/'a').each{|e| e.raw_attributes['href'] = "foo" }

Is this intended behavior? If so, should I edit the wiki?

Note: See TracTickets for help on using tickets.