summaryrefslogtreecommitdiff
path: root/src/lxml/serializer.pxi
diff options
context:
space:
mode:
Diffstat (limited to 'src/lxml/serializer.pxi')
-rw-r--r--src/lxml/serializer.pxi9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi
index a3d22365..489ed2de 100644
--- a/src/lxml/serializer.pxi
+++ b/src/lxml/serializer.pxi
@@ -954,7 +954,14 @@ cdef class _IncrementalFileWriter:
if self._status > WRITER_IN_ELEMENT or content.strip():
raise LxmlSyntaxError("not in an element")
content = _utf8(content)
- tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)
+
+ ns, name, _, _ = self._element_stack[-1]
+ if c_method == OUTPUT_METHOD_HTML and \
+ ns in (None, 'http://www.w3.org/1999/xhtml') and name in ('script', 'style'):
+ tree.xmlOutputBufferWrite(self._c_out, len(content), content)
+ else:
+ tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)
+
elif iselement(content):
if self._status > WRITER_IN_ELEMENT:
raise LxmlSyntaxError("cannot append trailing element to complete XML document")