This method handles the special case where the Element() constructor is called to set up the
document's root element.
# - - - E l e m e n t . _ _ w r a p R o o t - - -
def __wrapRoot ( self, parent, **attrs ):
"""Set up an Element wrapping the document root element.
[ (parent is a Document) and
(attrs is a dictionary of attribute names and values) ->
self.node := parent.node.documentElement with
attributes from attrs attached
self.doc := parent ]
"""
Since the actual DOM Element has already
been created, and lives in the document's .documentElement attribute, all we have to do is
set up the class invariants, then copy in any attributes
from the attrs argument.
#-- 1 --
self.node = parent.node.documentElement
self.doc = parent
#-- 2 --
# [ if attrs is a dictionary ->
# self.node := self.node with attribute names
# (with trailing "_" removed if present) and
# corresponding values from attrs
# else -> I ]
if attrs:
self.update ( attrs )