Kaydet (Commit) ed525fb0 authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Fix getElementsByTagNameNS:

  - actually return a result
  - Compare with tag.localName in getElementsByTagNameNSHelper
üst 453163d8
......@@ -279,7 +279,7 @@ def _getElementsByTagNameHelper(parent, name, rc):
def _getElementsByTagNameNSHelper(parent, nsURI, localName, rc):
for node in parent.childNodes:
if node.nodeType == Node.ELEMENT_NODE:
if ((localName == "*" or node.tagName == localName) and
if ((localName == "*" or node.localName == localName) and
(nsURI == "*" or node.namespaceURI == nsURI)):
rc.append(node)
_getElementsByTagNameNSHelper(node, nsURI, localName, rc)
......@@ -551,7 +551,9 @@ class Element(Node):
return _getElementsByTagNameHelper(self, name, [])
def getElementsByTagNameNS(self, namespaceURI, localName):
_getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
rc = []
_getElementsByTagNameNSHelper(self, namespaceURI, localName, rc)
return rc
def __repr__(self):
return "<DOM Element: %s at %s>" % (self.tagName, id(self))
......@@ -880,7 +882,9 @@ class Document(Node):
return a
def getElementsByTagNameNS(self, namespaceURI, localName):
_getElementsByTagNameNSHelper(self, namespaceURI, localName)
rc = []
_getElementsByTagNameNSHelper(self, namespaceURI, localName, rc)
return rc
def getElementsByTagName(self, name):
rc = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment