Re: Maybe a Bug in the html interpreter

Peter Cech <[email protected]>
Newsgroups gmane.comp.web.links.list
Message-ID <[email protected]>
On Sun, Feb 15, 2004 at 11:23:56PM -0300, Denis wrote:
> Hello all,
> 
> I don't know if it's the right list, but i haven't found a devl-list.
> The case is this, i was writing a html page and this lines didn't work
> in links, elinks and links 2:
> ---
> <b>Clik <a href="somewhere.html"></b>Here<b>...</a></b><br>
> <i>Clik <a href="somewhere.html"></i>Here<i>...</a></i><br>
> ---
> I cannot access the links in the viewer, but in other browsers (lynx,
> konqueror and mozilla) this works fine.

The tags in your html are icorrectly nested. When you open a tag (child)
inside another one (parent), you have to close it before closing parent
tag. Examples:
Incorrect: <parent>Bla <child>...</parent></child>
Correct:   <parent>Bla <child>...</child></parent>

Some browsers are able to correct such broken html code and if
their guess is coorect, it will render as was intended.

To fix the code, just swap the order of <a...> and </b> tags.

> If i invert the bold and italic code, the thwo links works:
> ---
> </b>Clik <a href="somewhere.html"><b>Here</b>...</a><br>
> </i>Clik <a href="somewhere.html"><i>Here</i>...</a><br>
> ---

In this case the nesting is correct.

> the entire page i tested was this:
> ---
> <html>
> <head>
> </head>
> <body>
> <b>Clik <a href="somewhere.html"></b>Here<b>...</a></b><br>
> <i>Clik <a href="somewhere.html"></i>Here<i>...</a></i><br>
> </b>Clik <a href="somewhere.html"><b>Here</b>...</a><br>
> </i>Clik <a href="somewhere.html"><i>Here</i>...</a><br>
> </body>
> </html>
> ---
> 
> is it a bug? or what?

No. If you have incorrect input, you should expect incorrect output. 
I would suggest you to use html validator (at example
http://validator.w3.org). At first you may be surprised how many
complaints against your code it has, but believe me, everybody browsing
your webpages will appreciate the pages that display correctly in any
browser.

Here is a template I'm using for my webpages. When you change doctype
from XHTML 1.0 Transitional to older standard (e.g. HTML 4.0
Transitional), remove <?xml...> line and xmlns attribute from html tag.
Also supply proper encoding if you are not using UTF-8.

<?XML version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="content-language" content="en" />
  <meta name="author" content="" />
  <meta name="description" content="" />
  <meta name="keywords" content="" />
  <title></title>
<body>
</body>
</html>

Hope I helped you.

Regards,
Peter
_______________________________________________
Links-list mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/links-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.