From 27c11892c829a249b997f896b29cdf26ac9f38f2 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Mon, 31 Dec 2018 07:24:25 +0900 Subject: [ruby/rexml] Add a TODO for Attribute#namespace https://github.com/ruby/rexml/commit/70310a06e5 --- lib/rexml/attribute.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/rexml') diff --git a/lib/rexml/attribute.rb b/lib/rexml/attribute.rb index 4ae8b10062..37671cf15f 100644 --- a/lib/rexml/attribute.rb +++ b/lib/rexml/attribute.rb @@ -86,6 +86,20 @@ module REXML # e.add_attribute("nsx:a", "c") # e.attribute("ns:a").namespace # => "http://url" # e.attribute("nsx:a").namespace # => nil + # + # TODO: This method should always return nil for no namespace + # attribute. Because the default namespace doesn't apply to + # attribute name. + # + # From https://www.w3.org/TR/xml-names/#uniqAttrs + # + # > the default namespace does not apply to attribute names + # + # e = REXML::Element.new("el") + # e.add_namespace("", "http://example.com/") + # e.namespace # => "http://example.com/" + # e.add_attribute("a", "b") + # e.attribute("a").namespace # => nil def namespace arg=nil arg = prefix if arg.nil? @element.namespace arg -- cgit v1.2.3