W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2009

Re: Tidy support for JavaScript

From: Richard O'Keefe <ok@cs.otago.ac.nz>
Date: Tue, 12 May 2009 12:46:13 +1200
Cc: html-tidy@w3.org
Message-Id: <4F3E8EF6-04B5-44B7-9080-8E7B700A2784@cs.otago.ac.nz>
To: "Ivor O'Connor" <ivor.oconnor@gmail.com>

On 7 May 2009, at 2:51 am, Ivor O'Connor wrote:

> ---------- Forwarded message ----------
> From: Ivor O'Connor <ivor.oconnor@gmail.com>
> Date: Wed, May 6, 2009 at 7:46 AM
> Subject: Re: Tidy support for JavaScript
> To: Arnaud Desitter <arnaud02@users.sourceforge.net>
> Hmmm. A tool for pretty printing html and no support for what is  
> almost always contained in html?

(1) Tidy is NOT a tool for pretty-printing HTML.
     It is a tool for FIXING broken HTML, as produced
     by far too many tools (including commercial ones).

(2) It may be the case that JavaScript is almost always
     contained in HTML -- the JavaScript that I've done
     isn't, but let it pass -- but it does not follow that
     HTML almost always contains JavaScript.  I just wrote
     a wee program to check for "<script " and got found
     that about 41% of >100,000 HTML files on my machine
     contained scripts.  YMMV of course.

(3) JavaScript syntax is much more complicated than HTML syntax
     and has changed quite a bit over the last 10 years.
     At least for HTML, there is a rough consensus about what
     pretty-printing amounts to -- although it _is_ only a
     _rough_ consensus -- while for programming languages like
     JavaScript there is much less agreement.

(4) If you keep your JavaScript in separate .js files, where
     it belongs, you can use http://jsbeautifier.org/ to
     tidy it.  (Or any of several others, of course.)
Received on Tuesday, 12 May 2009 00:47:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:57 UTC