mirror of
https://github.com/python/cpython.git
synced 2025-12-09 18:48:05 +00:00
Attribute nodes did not always get their ownerDocument and ownerElement
properly set. This fixes that.
This commit is contained in:
parent
6b04ffe9e5
commit
2998a55f2d
3 changed files with 41 additions and 4 deletions
|
|
@ -166,6 +166,23 @@ def testLegalChildren():
|
|||
elem.appendChild(text)
|
||||
dom.unlink()
|
||||
|
||||
def testNamedNodeMapSetItem():
|
||||
dom = Document()
|
||||
elem = dom.createElement('element')
|
||||
attrs = elem.attributes
|
||||
attrs["foo"] = "bar"
|
||||
a = attrs.item(0)
|
||||
confirm(a.ownerDocument is dom,
|
||||
"NamedNodeMap.__setitem__() sets ownerDocument")
|
||||
confirm(a.ownerElement is elem,
|
||||
"NamedNodeMap.__setitem__() sets ownerElement")
|
||||
confirm(a.value == "bar",
|
||||
"NamedNodeMap.__setitem__() sets value")
|
||||
confirm(a.nodeValue == "bar",
|
||||
"NamedNodeMap.__setitem__() sets nodeValue")
|
||||
elem.unlink()
|
||||
dom.unlink()
|
||||
|
||||
def testNonZero():
|
||||
dom = parse(tstfile)
|
||||
confirm(dom)# should not be zero
|
||||
|
|
@ -188,6 +205,11 @@ def testAAA():
|
|||
el = dom.documentElement
|
||||
el.setAttribute("spam", "jam2")
|
||||
confirm(el.toxml() == '<abc spam="jam2"/>', "testAAA")
|
||||
a = el.getAttributeNode("spam")
|
||||
confirm(a.ownerDocument is dom,
|
||||
"setAttribute() sets ownerDocument")
|
||||
confirm(a.ownerElement is dom.documentElement,
|
||||
"setAttribute() sets ownerElement")
|
||||
dom.unlink()
|
||||
|
||||
def testAAB():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue