Ticket #155 (new defect)
[PATCH] REXML::Element#delete_attribute not behaving correctly
| Reported by: | fbuilesv | Owned by: | ser |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | DOM | Version: | 3.1.6 |
| Severity: | normal | Keywords: | |
| Cc: | fbuilesv | Ruby version: | 1.8.6 |
| Operating system: | MacOS |
Description
Detailed description
According to the REXML::Element#delete_attribute docs, it should be able to receive either a String or an Attribute and then proceed to delete it if it exists. This is currently failing when it receives an Attributes as the parameter:
e = REXML::Element.new("foo")
=> <foo/>
a = REXML::Attribute.new("bar", "bla")
=> bar='bla'
e.add_attribute(a)
=> bar='bla'
e.delete_attribute(a)
=> nil
e.attributes
=> {"bar"=>bar='bla'} # attribute was not removed
The attached patch fixes it by making sure it passes only the Attribute's name to Attributes#get_attributes.
