W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2000

Treatment of <script>

From: Hubert Kauker <Hubert.Kauker@Stinnes.de>
Date: Fri, 10 Nov 2000 12:38:17 +0100
Message-ID: <3A0BDE28.96F23026@Stinnes.de>
To: html-tidy@w3.org, hubert.kauker@Stinnes.de
Hello all.

1. A script defined after the <body> of a document, is silently moved inside.
Do you think that is ok?
I have a few webpages where I'd rather prefer the scripts stayed where I put them to
ensure they are executed after the body's onLoad event.
See the sample below.

2. To enhance readability, should not a blank line be generated in front of the opening
<script> and after the closing </script> lines ?
3. And how about indenting a script block?
4. Of course, tidying *inside* the block is quite a different matter still and might not
be the scope of Tidy at all.
Who knows a suitable "plugin" for that, i.e. a javascript code beautifier ?

Now here's the sample:

INPUT:
======
<html>
<head><title>Tidy Test</title>
<script>
 alert ("head")
</script>
</head>
<body>
<h2>This is a Test</h2>
<script>
 alert ("body")
</script>
</body>
<script>
 alert ("after body")
</script>
</html>


OUTPUT:
=======
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
  <head>
    <title>Tidy Test</title>
<script type="text/javascript">
        alert ("head")
</script>
  </head>

  <body>
    <h2>This is a Test</h2>
<script type="text/javascript">
        alert ("body")
</script>
<script type="text/javascript">
        alert ("after body")
</script>
  </body>
</html>


Mit freundlichen Grüßen,
Hubert Kauker

travel-BA.Sys GmbH & Co. KG
Backoffice- & AdministrationsSysteme
Alexanderstrasse 38
D-45472 Mülheim an der Ruhr, Germany
www.travelbasys.de

Telefon: +49 208 494 7360. Fax: +49 208 491587
mailto:hubert.kauker@stinnes.de
Received on Friday, 10 November 2000 06:36:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT