[XML-SIG] [ pyxml-Patches-410065 ] Range.surroundContents()
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 20 Mar 2001 09:14:14 -0800
Patches item #410065, was updated on 2001-03-20 09:14
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=306473&aid=410065&group_id=6473
Category: 4Suite
Group: None
Status: Open
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Range.surroundContents()
Initial Comment:
Hi.
I just started using your lib. First of all:
congratulations, good
job. However, the surroundContents-Method of the Range-
Object is
broken (at least in my version [0.10.2
], maybe you fixed it already).
First of all, calling it surround instead of surrond
would keep
newbies like am am with Python from getting serious
problems with
their self-esteem ;-)
The major issue is, that you called insertNode after
having removed
the Range's contents by calling extractContents, which
has to fail,
scince then arbitrary siblings of the Range are at
self.startOffset,
somtimes None. Here is a fix, maybe there is a more
elegant solution,
I already mentioned I'm a newbie to Python.
Regards
Henrik Motakef
884,885c884,885
< def surroundContents(self,newParent):
< """Surround the range with this node"""
---
> def surrondContents(self,newParent):
> """Surrond the range with this node"""
916c916
< df = self.cloneContents()
---
> df = self.extractContents()
918,922c918
< newParent.appendChild(df)
<
< refNode = self.startContainer.childNodes
[self.startOffset]
<
< self.startContainer.insertBefore(newParent,
refNode)
---
> self.insertNode(newParent)
924c920
< self.startContainer.removeChild
(newParent.nextSibling)
---
> newParent.appendChild(df)
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=306473&aid=410065&group_id=6473