Don't create empty Namespace nodes.
This commit is contained in:
parent
4e18989972
commit
3b2279e410
|
@ -338,8 +338,12 @@ Unexpected #{name} with value #{value.inspect} on line #{@line}:
|
||||||
# @return [Oga::XML::Element]
|
# @return [Oga::XML::Element]
|
||||||
#
|
#
|
||||||
def on_element(namespace, name, attributes = {})
|
def on_element(namespace, name, attributes = {})
|
||||||
|
if namespace
|
||||||
|
namespace = Namespace.new(:name => namespace)
|
||||||
|
end
|
||||||
|
|
||||||
element = Element.new(
|
element = Element.new(
|
||||||
:namespace => Namespace.new(:name => namespace),
|
:namespace => namespace,
|
||||||
:name => name,
|
:name => name,
|
||||||
:attributes => attributes
|
:attributes => attributes
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,6 +13,10 @@ describe Oga::XML::Parser do
|
||||||
example 'set the name of the element' do
|
example 'set the name of the element' do
|
||||||
@element.name.should == 'p'
|
@element.name.should == 'p'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
example 'do not set a namespace' do
|
||||||
|
@element.namespace.nil?.should == true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'elements with namespaces' do
|
context 'elements with namespaces' do
|
||||||
|
|
Loading…
Reference in New Issue