Hi developers there, I found (hope so) a bug in parsing HTML comments. Acording to HTML 4.01 spec it is possible to make such a comment: <!-- This is OK commment -- > Please show me... Point your browsers here: http://eva.fit.vutbr.cz/~xnowak01/comment2.html I talk about the (white)space after two dashes. I CVS version the "Please show me..." sentence is not shown. After this "patch" is: --- html.c 2006-01-04 22:45:34.000000000 +0100 +++ html.c 2006-01-05 01:49:17.000000000 +0100 @@ -4936,7 +4936,10 @@ * everything except a matching "-->" tag. */ while ( (p = memchr(buf + buf_index, '>', bufsize - buf_index)) ){ buf_index = p - buf + 1; - if ( p[-1] == '-' && p[-2] == '-' ) break; + gint counter = -1; + while (isspace(p[counter])) + counter--; + if ( p[counter] == '-' && p[counter-1] == '-' ) break; } if ( p ) { /* Got the whole comment. Let's throw it away! :) */ It's hackish and ugly. I know. From: http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4 "White space is not permitted between the markup declaration open delimiter("<!") and the comment open delimiter ("--"), but is permitted between the comment close delimiter ("--") and the markup declaration close delimiter (">"). A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments." Michal Nowak
You know, I would actually prefer it if Dillo does *not* fix this bug. It would be nice to have a "hide from Dillo" HTML trick up my sleeve for doing web design. For example, Dillo renders tables differently than how Netscape/Firefox/MSIE renders tables. It would be nice to be ale to make HTML code like this: <!-- Hide this table from Dillo -- ><table width=800><tr><td><!--end hide table --> If Dillo fixes this bug, I will have to figure out some other way to hide my HTML from Dillo (or be unable to make my web pages look good in Dillo-- MSIE's CSS is just too primitive for me to completely get rid of tables) - Sam
Sam Trenholme wrote:
You know, I would actually prefer it if Dillo does *not* fix this bug. It would be nice to have a "hide from Dillo" HTML trick up my sleeve for doing web design. For example, Dillo renders tables differently than how Netscape/Firefox/MSIE renders tables. It would be nice to be ale to make HTML code like this:
<!-- Hide this table from Dillo -- ><table width=800><tr><td><!--end hide table -->
If Dillo fixes this bug, I will have to figure out some other way to hide my HTML from Dillo (or be unable to make my web pages look good in Dillo-- MSIE's CSS is just too primitive for me to completely get rid of tables)
- Sam
Hello Sam, you are right - it's useful, but it is a hack. It's just hiding Dillo's style of table rendering (which is now being rewriten). I think we should follow specs. Maybe this tiny CSS hacks will help you: http://wellstyled.com/css-underscore-hack.html #item { color: black; /* style for all browsers */ _color: red; /* style for all IE/Win browsers */ _color/**/: orange; /* style for IE/Win 5.5+ browsers */ _co\lor: yellow; /* style for IE/Win 6.0+ browsers */ } I found that comment bug when I was passing by Acid2 test with dillo (http://webstandards.org/act/acid2/). Michal Nowak
Hi Sam, On Thu, Jan 05, 2006 at 01:41:53AM +0000, Sam Trenholme wrote:
You know, I would actually prefer it if Dillo does *not* fix this bug. It would be nice to have a "hide from Dillo" HTML trick up my sleeve for doing web design. For example, Dillo renders tables differently than how Netscape/Firefox/MSIE renders tables. It would be nice to be ale to make HTML code like this:
<!-- Hide this table from Dillo -- ><table width=800><tr><td><!--end hide table -->
If Dillo fixes this bug, I will have to figure out some other way to hide my HTML from Dillo (or be unable to make my web pages look good in Dillo-- MSIE's CSS is just too primitive for me to completely get rid of tables)
What kind of tables do you have problems with? Please provide an example and explanation. I like the idea of fixing the comment bug, but I would also like to know what's the problem with table rendering. -- Cheers Jorge.-
On Sat, Jan 21, 2006 at 04:56:01PM -0300, Jorge Arellano Cid wrote:
I like the idea of fixing the comment bug
Hi Jorge, note that the HTML (i.e., SGML) comment rules allow not only spaces as in <!-- comment -- > but also repeated comments as in <!-- comment -- -- bla bla -- > Maybe the space in the middle can even be omitted so as to yield "----". (I don't have an SGML reference at home.) More generally, comments are allowed in (at least?) "<!" constructs, as in the following example, taken from the HTML 4.01 DTD: <!ELEMENT HR - O EMPTY -- horizontal rule --> But usually web browsers don't support these elements apart from "pure" comments as above. In XHTML (i.e., XML), rules are much simpler: a comment starts with "<!--" and ends with the first occurence of "--", which must be followed by ">". All the best, -- Matthias Franz
participants (4)
-
Jorge Arellano Cid
-
Matthias Franz
-
Michal Nowak
-
Sam Trenholme