1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-28 00:21:53 +03:00

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
This commit is contained in:
Daniel Veillard
2010-03-15 15:47:50 +01:00
parent 615904f582
commit 3c080d6d72
5 changed files with 30 additions and 27 deletions

View File

@ -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;

8
SAX2.c
View File

@ -1105,6 +1105,13 @@ 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
@ -1123,6 +1130,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
#else
nval = NULL;
#endif /* LIBXML_VALID_ENABLED */
}
/*
* Check whether it's a namespace definition

View File

@ -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)

View File

@ -2566,7 +2566,7 @@ SAX.characters(
SAX.endElement(br)
SAX.characters(
, 14)
SAX.endElement(font)
SAX.endElement(font)
SAX.startElement(center)
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')
@ -2713,7 +2713,7 @@ SAX.startElement(noscript)
SAX.startElement(b)
SAX.startElement(noscript)
SAX.endElement(noscript)
SAX.endElement(b)
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, src='doc3_files/100x90.gif', width='100')
SAX.endElement(img)

View File

@ -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(