Commit 1396b5b6 authored by Guido van Rossum's avatar Guido van Rossum

- Use node.hasAttributes() rather than asking for node.attributes and

  then checking whether it is true.  (Should be slightly faster.)

- Use getAttributeNodeNS() to check for z:omit="" properly.
parent 4b1f6df5
......@@ -115,7 +115,7 @@ class TALVisitor(CopyingDOMVisitor):
self.slotIndex = None
def visitElement(self, node):
if not node.attributes:
if not node.hasAttributes():
CopyingDOMVisitor.visitElement(self, node)
return
macroName = node.getAttributeNS(ZOPE_METAL_NS, "use-macro")
......@@ -131,12 +131,10 @@ class TALVisitor(CopyingDOMVisitor):
if slotNode:
self.visitElement(slotNode)
return
if node.getAttributeNS(ZOPE_TAL_NS, "omit"):
# XXX Problem: this DOM implementation doesn't
# differentiate between argument empty and argument
# absent.
if node.getAttributeNodeNS(ZOPE_TAL_NS, "omit"):
# XXX Question: should 'omit' be done before or after
# 'define'?
# 'define'? (I.e., is it a shortcut for
# z:condition:"false" or is it stronger?)
return
defines = node.getAttributeNS(ZOPE_TAL_NS, "define")
if defines:
......
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