lynx-dev
[Top][All Lists]
Advanced

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

LYNX-DEV A question about <SCRIPT> <!-- comment --> </SCRIPT>


From: --- Alvian ---
Subject: LYNX-DEV A question about <SCRIPT> <!-- comment --> </SCRIPT>
Date: Sat, 12 Apr 97 10:50:26 +1000

Dear HTML & Lynx gurus,

I have a question about comment inside a SCRIPT block.  I have
tried my best to learn to write legal comments and to understand 
what is valid inside a SCRIPT block.  But I am still puzzled.
(BTW, I am using vanilla Lynx 2.7.1 on Ultrix.)

Here is an example HTML file:
----------
<HTML><HEAD><TITLE>A test page</TITLE>
<SCRIPT>
<!-- Begin comment
Lynx ignores things in a script block.  Lynx ignores things
inside a comment block.  Should Lynx ignore the following tag?
</SCRIPT>
But: (1) can a comment exists in a script block and<p>
(2) should Lynx keep a look out for comments within a script block?
// End the comment here. -->
</SCRIPT>
</HEAD> <BODY>
This is normal body text. <p>
End of demonstration.
</BODY> </HTML>
----------

Here is the relevant section of trace:
----------
StreamStack: found exact match: text/html
SGML: Start <HTML>
GridText: Change to style Normal
GridText: split_line called
HTML:begin_element: adding style to stack - Normal
SGML: Start <HEAD>
HTML:begin_element: adding style to stack - Normal
SGML: Start <TITLE>
HTML:begin_element: adding style to stack - Normal
SGML: End </TITLE>
HTML:end_element: Popped style off stack - Normal
SGML: Start <SCRIPT>
HTML:begin_element: adding style to stack - Normal
SGML: End </SCRIPT>
HTML:end_element: Popped style off stack - Normal
HTML: SCRIPT content =

<!-- Begin comment
Lynx ignores things in a script block.  Lynx ignores things
inside a comment block.  Should Lynx ignore the following tag?

SGML: Start <P>
GridText: split_line called
GridText: split_line called
GridText: split_line called
SGML: End </SCRIPT>
SGML: Found </SCRIPT> when expecting </HEAD>. </HEAD> assumed.
HTML:end_element: Popped style off stack - Normal
SGML: End </HEAD>
SGML: Found </HEAD> when expecting </HTML>. </HEAD> Ignored.
SGML: Start <BODY>
HTML:begin_element: adding style to stack - Normal
SGML: Start <P>
GridText: split_line called
GridText: split_line called
SGML: End </BODY>
HTML:end_element: Popped style off stack - Normal
SGML: End </HTML>
HTML:end_element: Popped style off stack - Normal
GridText: split_line called
GridText: Removing bottom blank line: 
GridText: New bottom line: End of demonstration.
Gridtext: Entering HText_endAppend
----------

It is easy to see what is happening.  Lynx saw a <SCRIPT> tag and
started to ignore everything until it had found a </SCRIPT> tag.  My
confusion is this:  Are comments legal within a SCRIPT block?  If
they are legal then the </SCRIPT> tag on line 2 should not turn the
comment off.  If they are illegal then please tell me, because I am too
dumb to understand the HTML 3.2 Reference Specification (can't figure
out what those containers mean).

From HTML 3.2 Reference Specification:
----------
STYLE and SCRIPT

<!ELEMENT STYLE  - - CDATA -- placeholder for style info -->
<!ELEMENT SCRIPT - - CDATA -- placeholder for script statements -->

These are place holders for the introduction of style sheets and
client-side scripts in future versions of HTML. User agents should
hide the contents of these elements.

These elements are defined with CDATA as the content type. As a result
they may contain only SGML characters. All markup characters or
delimiters are ignored and passed as data to the application, except
for ETAGO ("</") delimiters followed immediately by a name character
[a-zA-Z]. This means that the element's end-tag (or that of an element
in which it is nested) is recognized, while an error occurs if the
ETAGO is invalid.
----------

This seems to say comments are effectively illegal in a SCRIPT block,
because everything but </[a-zA-Z] should be ignored.  Is this so?  Why
does the spec want you to look at </[a-rt-zA-RT-Z] since only a
</SCRIPT> will close the SCRIPT block?  Why do script authors
put a comment immediately inside a SCRIPT block to shield the
instructions?

In case you are wondering, I saw this (Java?) SCRIPT which delivers a
html-file, complete with another script, and the nested/delivered/
secondary </SCRIPT> was closing the primary script prematurely.

Very confused,
  Alvian Tam  (address@hidden).
                      ________  ________
                     / ____  / / ____  /
                    / /   / / / /   / /      Start.
                   / /   / / / /   / /
                  / /___/ / / /___/ /    Start waiting.
                 /_______/ /_______/
                ________  ________       Start paying.
               / ____  / / ____  /
              / /   / / / /   / /       Start spending.
             / /   / / / /   / /
            / /___/ / / /___/ /        Start Windoze 95.
           /_______/ /_______/

         Start wondering.... How will you be fooled today?
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

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