Don't use Namespace#to_s when matching namespaces
This is a waste of time as it allocates a new String on every call.
This commit is contained in:
parent
b9145d83f8
commit
0298e7068c
|
@ -1702,7 +1702,9 @@ module Oga
|
||||||
def namespace_matches?(xml_node, ns)
|
def namespace_matches?(xml_node, ns)
|
||||||
return false unless xml_node.respond_to?(:namespace)
|
return false unless xml_node.respond_to?(:namespace)
|
||||||
|
|
||||||
return ns == STAR ? true : xml_node.namespace.to_s == ns
|
return true if ns == STAR
|
||||||
|
|
||||||
|
return xml_node.namespace && xml_node.namespace.name == ns
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Reference in New Issue