diff --git a/CHANGELOG.md b/CHANGELOG.md index 62339b3..6e11285 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,12 +3,13 @@ This document contains details of the various releases and their release dates. Dates are in the format `yyyy-mm-dd`. -## Unreleased +## 2.10 - 2017-04-18 -### Fix `Element#attribute` result for HTML doc when `Symbol` passed as name +### Fix `Element#attribute` for HTML documents when using Symbol arguments -Using `Symbol` is working for XML doc, but was not working for HTML doc. -See [PR #174](https://github.com/YorickPeterse/oga/pull/174) +You can now pass a Symbol to `Oga::XML::Element#attribute` for both XML and HTML +documents, previously this only worked for XML documents. See [PR +#174](https://github.com/YorickPeterse/oga/pull/174) for more information. ## 2.9 - 2017-02-10 diff --git a/spec/oga/xml/element_spec.rb b/spec/oga/xml/element_spec.rb index fe7558f..16455fe 100644 --- a/spec/oga/xml/element_spec.rb +++ b/spec/oga/xml/element_spec.rb @@ -107,22 +107,25 @@ describe Oga::XML::Element do end describe 'using an HTML document' do - let!(:attr) do - Oga::XML::Attribute.new(:name => 'foo:bar', :value => 'foo') + let(:attr) do + Oga::XML::Attribute.new(name: 'foo:bar', value: 'foo') end - let!(:el) do - described_class.new(:name => 'foo', :attributes => [attr]) - end - let!(:doc) do - Oga::XML::Document.new(:children => [el], :type => :html) + + let(:el) do + el = described_class.new(name: 'foo', attributes: [attr]) + Oga::XML::Document.new(children: [el], type: :html) + + el end it 'returns an attribute with a name containing a namespace separator' do el.attribute('foo:bar').should == attr end - it 'returns an attribute with a name containing a namespace separator when using a Symbol' do - el.attribute(:'foo:bar').should == attr + describe 'using a Symbol argument' do + it 'returns the attribute' do + el.attribute(:'foo:bar').should == attr + end end end end