lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev question about embedded javascript


From: Ismael Cordeiro
Subject: Re: lynx-dev question about embedded javascript
Date: Tue, 5 Jan 1999 10:22:00 -0500 (EST)

On Sun, 3 Jan 1999, David Woolley wrote:

> > Isn't embedded JavaScript wrapped with comment delimiters, "<!--" and "-->"?
>
> These are not comment delimiters, -- is the comment delimiter, within an
> SGML declaration, and possibly within a tag in general.  It's because of
> this that Lynx needs broken comment modes for constructs like:
>
> <!------>
>
> which is one trivial comment and one unclosed one.
>
> > (And doesn't this cause problems when there's a decrement operator
> > in the Java?
>              ^script
>
> The use of comments is a backwards compatibility measure for non JS aware
> browsers.  Such browsers are also likely to have faulty SGML comment parsing.
> It arises because HTML was never intended to contain text which should not
> be rendered, so the built in forward compatibility measures (ignore unknown
> tags) break down.

Well, if "HTML was never intended to contain text which should not be
rendered", why the specs for HTML 2.0, 3.0 and 4.0 say

HTML 2.0
========

|    To include comments in an HTML document, use a comment declaration. A
|    comment declaration consists of `<!' followed by zero or more comments
|    followed by `>'. Each comment starts with `--' and includes all text
|    up to and including the next occurrence of `--'. In a comment
|    declaration, white space is allowed after each comment, but not before
|    the first comment. The entire comment declaration is ignored. (10)
|
|    For example:
| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
| <HEAD>
| <TITLE>HTML Comment Example</TITLE>
| <!-- Id: html-sgml.sgm,v 1.5 1995/05/26 21:29:50 connolly Exp  -->
| <!-- another -- -- comment -->
| <!>
| </HEAD>
| <BODY>
| <p> <!- not a comment, just regular old data characters ->

HTML 3.0
========

|    To include comments in an HTML document that will be ignored by the
|    parser, surround them with <!-- and -->. After the comment delimiter,
|    all text up to the next occurrence of --> is ignored. Hence comments
|    cannot be nested. White space is allowed between the closing -- and >,
|    but not between the opening <! and --.
|
|    For example:
| <HEAD>
| <TITLE>HTML Guide: Recommended Usage</TITLE>
| <!-- Id: Text.html,v 1.6 1994/04/25 17:33:48 connolly Exp -->
| </HEAD>
|
|    Note: Some historical implementations incorrectly consider a > sign to
|    terminate a comment.

HTML 4.0
========

|    HTML comments have the following syntax:
|
| <!-- this is a comment -->
| <!-- and so is this one,
|     which occupies more than one line -->
|
|    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.
|
|    Information that appears between comments has no special meaning
|    (e.g., character references are not interpreted as such).

By the way, when you say "The use of comments is a backwards compatibility
measure for non JS aware browsers. Such browsers are also likely to have
faulty SGML comment parsing." do you mean that Lynx is "likely to have
faulty SGML comment parsing" and that "JS aware browsers" are not?

Ismael
-- 

       +--------------------------------------------------------------+
       | ISMAEL CORDEIRO            | mailto:address@hidden      |
       | Production sound mixer     | http://www.ismael.cordeiro.com/ |
       | Montréal - Québec - Canada | ftp://ftp.cam.org/users/ismael/ |
       +--------------------------------------------------------------+

reply via email to

[Prev in Thread] Current Thread [Next in Thread]