summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
authorKouhei Sutou <kou@clear-code.com>2018-12-31 07:24:25 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-04 11:54:05 +0900
commit27c11892c829a249b997f896b29cdf26ac9f38f2 (patch)
treeb0238d420e7b5e5e77568648d6600982ad1e5fb9 /lib/rexml
parent3583fa166c52aff1ac6fab310e9133c553efcc4a (diff)
[ruby/rexml] Add a TODO for Attribute#namespace
https://github.com/ruby/rexml/commit/70310a06e5
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/attribute.rb14
1 files changed, 14 insertions, 0 deletions
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