[libxml2] Don't give default HTML boolean attribute values in parser
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Don't give default HTML boolean attribute values in parser
- Date: Mon, 15 Mar 2010 14:51:50 +0000 (UTC)
commit 3c080d6d723b5cee379804cfa6bf394df6057f67
Author: Daniel Veillard <veillard redhat com>
Date: Mon Mar 15 15:47:50 2010 +0100
Don't give default HTML boolean attribute values in parser
* HTMLparser.c: don't default value of HTML boolean attributes in the
parser
* SAX2.c: move this to SAX2 tree building backend
* result/HTML/doc2.htm.sax result/HTML/doc3.htm.sax
result/HTML/wired.html.sax: this changes a few HTML SAX regression
tests
HTMLparser.c | 5 -----
SAX2.c | 38 +++++++++++++++++++++++---------------
result/HTML/doc2.htm.sax | 6 +++---
result/HTML/doc3.htm.sax | 4 ++--
result/HTML/wired.html.sax | 4 ++--
5 files changed, 30 insertions(+), 27 deletions(-)
---
diff --git a/HTMLparser.c b/HTMLparser.c
index a3fbb7f..3e2467c 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -3426,11 +3426,6 @@ htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) {
NEXT;
SKIP_BLANKS;
val = htmlParseAttValue(ctxt);
- } else if (htmlIsBooleanAttr(name)) {
- /*
- * assume a minimized attribute
- */
- val = xmlStrdup(name);
}
*value = val;
diff --git a/SAX2.c b/SAX2.c
index 1ed148f..04c0e30 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -1105,24 +1105,32 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
return;
}
+#ifdef LIBXML_HTML_ENABLED
+ if ((ctxt->html) &&
+ (value == NULL) && (htmlIsBooleanAttr(fullname))) {
+ nval = value = xmlStrdup(fullname);
+ } else
+#endif
+ {
#ifdef LIBXML_VALID_ENABLED
- /*
- * Do the last stage of the attribute normalization
- * Needed for HTML too:
- * http://www.w3.org/TR/html4/types.html#h-6.2
- */
- ctxt->vctxt.valid = 1;
- nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt,
- ctxt->myDoc, ctxt->node,
- fullname, value);
- if (ctxt->vctxt.valid != 1) {
- ctxt->valid = 0;
- }
- if (nval != NULL)
- value = nval;
+ /*
+ * Do the last stage of the attribute normalization
+ * Needed for HTML too:
+ * http://www.w3.org/TR/html4/types.html#h-6.2
+ */
+ ctxt->vctxt.valid = 1;
+ nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt,
+ ctxt->myDoc, ctxt->node,
+ fullname, value);
+ if (ctxt->vctxt.valid != 1) {
+ ctxt->valid = 0;
+ }
+ if (nval != NULL)
+ value = nval;
#else
- nval = NULL;
+ nval = NULL;
#endif /* LIBXML_VALID_ENABLED */
+ }
/*
* Check whether it's a namespace definition
diff --git a/result/HTML/doc2.htm.sax b/result/HTML/doc2.htm.sax
index f216ce3..7cbbc51 100644
--- a/result/HTML/doc2.htm.sax
+++ b/result/HTML/doc2.htm.sax
@@ -38,12 +38,12 @@ SAX.startElement(meta, content='MSHTML 5.00.3103.1000', name='GENERATOR')
SAX.endElement(meta)
SAX.endElement(head)
SAX.startElement(frameset, border='false', cols='172,*', frameborder='0', framespacing='0')
-SAX.startElement(frame, marginheight='0', marginwidth='0', name='left', noresize='noresize', scrolling='no', src='doc2_files/side.htm', target='rtop')
+SAX.startElement(frame, marginheight='0', marginwidth='0', name='left', noresize, scrolling='no', src='doc2_files/side.htm', target='rtop')
SAX.endElement(frame)
SAX.startElement(frameset, rows='43,*')
-SAX.startElement(frame, marginheight='0', marginwidth='0', name='rtop', noresize='noresize', scrolling='no', src='doc2_files/top.htm', target='rbottom')
+SAX.startElement(frame, marginheight='0', marginwidth='0', name='rtop', noresize, scrolling='no', src='doc2_files/top.htm', target='rbottom')
SAX.endElement(frame)
-SAX.startElement(frame, name='rbottom', noresize='noresize', src='doc2_files/contents.htm', target='_top')
+SAX.startElement(frame, name='rbottom', noresize, src='doc2_files/contents.htm', target='_top')
SAX.endElement(frame)
SAX.endElement(frameset)
SAX.startElement(noframes)
diff --git a/result/HTML/doc3.htm.sax b/result/HTML/doc3.htm.sax
index 3f32c4a..13477f1 100644
--- a/result/HTML/doc3.htm.sax
+++ b/result/HTML/doc3.htm.sax
@@ -2566,7 +2566,7 @@ SAX.characters(
, 14)
SAX.endElement(font)
SAX.startElement(center)
-SAX.startElement(iframe, frameborder='0', height='60', marginheight='0', marginwidth='0', noresize='noresize', scrolling='no', src='doc3_files/ad_iframe.htm', width='468')
+SAX.startElement(iframe, frameborder='0', height='60', marginheight='0', marginwidth='0', noresize, scrolling='no', src='doc3_files/ad_iframe.htm', width='468')
SAX.startElement(a, href='http://ads.adflight.com/go_static.asp?asid=7708', target='_top')
SAX.error: htmlParseEntityRef: expecting ';'
SAX.error: htmlParseEntityRef: expecting ';'
@@ -2713,7 +2713,7 @@ SAX.startElement(noscript)
SAX.endElement(noscript)
SAX.endElement(b)
SAX.startElement(a, href='http://www.goto.com/d/search/ssn/?fromGIF=true', target='_blank')
-SAX.startElement(img, align='bottom', border='0', height='90', ismap='ismap', src='doc3_files/100x90.gif', width='100')
+SAX.startElement(img, align='bottom', border='0', height='90', ismap, src='doc3_files/100x90.gif', width='100')
SAX.endElement(img)
SAX.endElement(a)
SAX.startElement(b)
diff --git a/result/HTML/wired.html.sax b/result/HTML/wired.html.sax
index 9d3e5f4..3860c76 100644
--- a/result/HTML/wired.html.sax
+++ b/result/HTML/wired.html.sax
@@ -49,7 +49,7 @@ SAX.characters(
SAX.startElement(select, name='state')
SAX.characters(
, 2)
-SAX.startElement(option, value='WA', selected='selected')
+SAX.startElement(option, value='WA', selected)
SAX.characters(WA
, 4)
SAX.endElement(option)
@@ -442,7 +442,7 @@ SAX.error: htmlParseEntityRef: expecting ';'
SAX.error: htmlParseEntityRef: expecting ';'
SAX.error: htmlParseEntityRef: expecting ';'
SAX.error: htmlParseEntityRef: expecting ';'
-SAX.startElement(option, value='http://search.hotwired.com/search97/s97.vts?Action=FilterSearch&Filter=docs_filter.hts&ResultTemplate=vignette.hts&Collection=vignette&QueryMode=Internet&Query=', selected='selected')
+SAX.startElement(option, value='http://search.hotwired.com/search97/s97.vts?Action=FilterSearch&Filter=docs_filter.hts&ResultTemplate=vignette.hts&Collection=vignette&QueryMode=Internet&Query=', selected)
SAX.characters(Wired News, 10)
SAX.endElement(option)
SAX.characters(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]