From 64b35282863d76c95f2258b0635668b147dcf809 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 4 Dec 2002 15:10:40 +0000 Subject: [PATCH] Chip turner indicated that XHTML1 serialization rule for style actually * tree.c: Chip turner indicated that XHTML1 serialization rule for style actually break on both IE and Mozilla, try to avoid the rule if escaping ain't necessary Daniel --- ChangeLog | 6 ++++++ tree.c | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index da71851e..7d2527da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Dec 4 16:08:49 CET 2002 Daniel Veillard + + * tree.c: Chip turner indicated that XHTML1 serialization + rule for style actually break on both IE and Mozilla, + try to avoid the rule if escaping ain't necessary + Wed Dec 4 12:43:28 CET 2002 Daniel Veillard * nanhttp.c: handle HTTP URL escaping, problem reported by diff --git a/tree.c b/tree.c index 6c436b50..b995c784 100644 --- a/tree.c +++ b/tree.c @@ -7092,11 +7092,22 @@ xhtmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, while (child != NULL) { if ((child->type == XML_TEXT_NODE) || (child->type == XML_CDATA_SECTION_NODE)) { - xmlOutputBufferWriteString(buf, "content != NULL) - xmlOutputBufferWriteString(buf, - (const char *)child->content); - xmlOutputBufferWriteString(buf, "]]>"); + /* + * Apparently CDATA escaping for style just break on IE, + * mozilla and galeon, so ... + */ + if (xmlStrEqual(cur->name, BAD_CAST "style") && + (xmlStrchr(child->content, '<') == NULL) && + (xmlStrchr(child->content, '>') == NULL) && + (xmlStrchr(child->content, '&') == NULL)) { + xhtmlNodeDumpOutput(buf, doc, child, 0, 0, encoding); + } else { + xmlOutputBufferWriteString(buf, "content != NULL) + xmlOutputBufferWriteString(buf, + (const char *)child->content); + xmlOutputBufferWriteString(buf, "]]>"); + } } else { xhtmlNodeDumpOutput(buf, doc, child, 0, 0, encoding); }