From 01f313af1ff9fd89891601e42522b94ce61a925d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 Nov 2013 14:01:49 +0530 Subject: [PATCH] Fix bug in cloneNode in lxml builder for html5lib parsing --- src/calibre/ebooks/oeb/polish/parsing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/parsing.py b/src/calibre/ebooks/oeb/polish/parsing.py index 777e5ac8cf..dee017145a 100644 --- a/src/calibre/ebooks/oeb/polish/parsing.py +++ b/src/calibre/ebooks/oeb/polish/parsing.py @@ -83,7 +83,10 @@ class Element(ElementBase): removeChild = ElementBase.remove def cloneNode(self): - return self.makeelement(self.tag, nsmap=self.nsmap, attrib=self.attrib) + ans = self.makeelement(self.tag, nsmap=self.nsmap, attrib=self.attrib) + for x in ('name', 'namespace', 'nameTuple'): + setattr(ans, x, getattr(self, x)) + return ans def insertBefore(self, node, ref_node): self.insert(self.index(ref_node), node) @@ -126,7 +129,6 @@ class Element(ElementBase): for child in self: new_parent.append(child) - class Comment(CommentBase): @dynamic_property