Quirks to Transitional tool

Discussion in 'Javascript' started by Martin Rinehart, Jan 14, 2009.

  1. I decided to upgrade my sites from quirks to transitional. To help, I
    wrote a little program that proved extremely handy:

    http://www.martinrinehart.com/examples/quirks2loose.html

    It comes with a few regex search/replace specs and lets you easily add
    more as needed. I converted and validated about 400 pages in 20 hours.

    You are welcome to use this as a service on my site. If you want to
    use it a lot, please grab the code and run it on your machine.

    I've not tried it, but my guess is that it would be equally helpful
    for loose to strict conversion.
    Martin Rinehart, Jan 14, 2009
    #1
    1. Advertising

  2. Martin Rinehart wrote:

    > I decided to upgrade my sites from quirks to transitional.


    You seem to have adopted strange notions about DOCTYPE declarations and
    their correspondence with render modes to begin with.

    A DOCTYPE declaration with or without system identifier (DTD URI) specifies
    against which DTD the document is supposed to validate. If the system
    identifier is missing, a UA is supposed to match against a catalog of
    public identifiers in order to determine the system identifier.

    Roughly speaking, the difference between Quirks/Compatibility Mode and
    Standards Compliance Mode is that the latter is triggered if the correct
    system identifier is provided. In all other cases, the former is
    triggered.

    It is _not_ as if there was a evolutionary hierarchy as you indicate here,
    like

    Quirks --> Transitional (loose) --> Strict

    See also <http://quirksmode.org/css/quirksmode.html>

    > To help, I wrote a little program that proved extremely handy:
    > [...]
    > I've not tried it, but my guess is that it would be equally helpful
    > for loose to strict conversion.


    This wheel has already been invented: <http://tidy.sourceforge.net/>
    (I use EclipseTidy when necessary.)


    PointedEars
    Thomas 'PointedEars' Lahn, Jan 14, 2009
    #2
    1. Advertising

  3. On Jan 14, 1:21 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > This wheel has already been invented: <http://tidy.sourceforge.net/>
    > (I use EclipseTidy when necessary.)


    Tidy is about 500kB of C. My little tool is 13kB of HTML and
    JavaScript, including the 3kB quick regex reference. Mine is handy for
    those who know regex and want to, for example, replace 'height=nn'
    with 'style="height:nnpx"'.
    Martin Rinehart, Jan 15, 2009
    #3
  4. Martin Rinehart wrote:

    > Thomas 'PointedEars' Lahn wrote:
    >> This wheel has already been invented: <http://tidy.sourceforge.net/>
    >> (I use EclipseTidy when necessary.)

    >
    > Tidy is about 500kB of C.


    The compiled version requires about 42 KiB *on my harddisk* along with
    documentation, installed with `aptitude install tidy'. EclipseTidy
    requires 292'605 bytes, but it has the virtue of integrating seemlessly
    with my IDE.

    > My little tool is 13kB of HTML and JavaScript,


    Not surprising, considering that it can do considerably less.
    Unfortunately, it also takes much more time for doing that
    ("400 pages in *20* hours"?).

    > including the 3kB quick regex reference. Mine is handy for those
    > who know regex and want to, for example, replace 'height=nn'
    > with 'style="height:nnpx"'.


    Have you considered "height=nn%"?

    It did not replace <table height="50"> and <table height=50> with
    <table style="height: 50px">. It did replace <table height=50> with
    <table style='height: 50'>, which is invalid CSS.

    It forces UTF-8 (what for?) but does not convert to character (entity)
    references in the document.

    You have not escaped all ETAGOs (</) in the source code. (You would not
    need to do that, had you used an external script file.)

    And ^G caused my Iceweasel to start searching backwards (I told you).

    Rest assured I'll consider your program as soon as it can clean up and save
    the file in one step.


    PointedEars
    Thomas 'PointedEars' Lahn, Jan 15, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DaLoverhino

    Some quirks in InputStream.read() ?

    DaLoverhino, Jan 23, 2005, in forum: Java
    Replies:
    6
    Views:
    501
    Rogan Dawes
    Jan 24, 2005
  2. kayodeok
    Replies:
    20
    Views:
    823
    Toby A Inkster
    Nov 1, 2003
  3. Jeff Thies

    quirks mode and IE5 vs IE6

    Jeff Thies, Feb 12, 2004, in forum: HTML
    Replies:
    26
    Views:
    2,451
    =?ISO-8859-1?Q?Andr=E9s_Sedano?=
    Feb 14, 2004
  4. Michael Jaeger

    quirks mode

    Michael Jaeger, Apr 28, 2004, in forum: HTML
    Replies:
    10
    Views:
    879
    Jeff Thies
    May 5, 2004
  5. chad kline

    piping/reading stdin quirks.

    chad kline, Oct 10, 2003, in forum: C Programming
    Replies:
    6
    Views:
    440
    Irrwahn Grausewitz
    Oct 11, 2003
Loading...

Share This Page