1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/rexml] Add a TODO for Attribute#namespace

70310a06e5
This commit is contained in:
Kouhei Sutou 2018-12-31 07:24:25 +09:00 committed by Hiroshi SHIBATA
parent 3583fa166c
commit 27c11892c8

View file

@ -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