Re: Learning the hard way [Was: Re: is there a javascript supportforum?] - Mozilla

This is a discussion on Re: Learning the hard way [Was: Re: is there a javascript supportforum?] - Mozilla ; ----- Original Message ---- > From: Glenn > > 1) SM counts newlines as 1 character (\n ?) > 2) IE and Opera count newlines as 2 characters (\r\n ?) FYI, line endings on Windows has always been \r\n while ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: Learning the hard way [Was: Re: is there a javascript supportforum?]

  1. Re: Learning the hard way [Was: Re: is there a javascript supportforum?]



    ----- Original Message ----
    > From: Glenn


    >
    > 1) SM counts newlines as 1 character (\n ?)
    > 2) IE and Opera count newlines as 2 characters (\r\n ?)


    FYI, line endings on Windows has always been \r\n while line endings on *nix-based systems is \n. Perhaps there is some relevancy.







    __________________________________________________ __________________________________
    Be a better friend, newshound, and
    know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i...Dypao8Wcj9tAcJ

  2. Re: Learning the hard way [Was: Re: is there a javascript supportforum?]

    On approximately 4/26/2008 8:48 AM, came the following characters from
    the keyboard of Eric H. Jung:
    >
    > ----- Original Message ----
    >> From: Glenn

    >
    >> 1) SM counts newlines as 1 character (\n ?)
    >> 2) IE and Opera count newlines as 2 characters (\r\n ?)

    >
    > FYI, line endings on Windows has always been \r\n while line endings on *nix-based systems is \n. Perhaps there is some relevancy.


    I was aware of that, and perhaps there is; however, all the tests above
    were done on Windows, with the same source files. So it would appear
    that SM is the "odd-duck" in only counting one character per line ending.

    The standard (HTML 4.01) doesn't mention newline with respect to
    textarea controls. Where it does talk about newlines, it allows all
    three choices used by Bell Labs, Microsoft, and Apple. On the other
    hand, IE7 violates section B.3.1 for tag.


    9.1 White space

    ....

    Line breaks are also white space characters. Note that although 

    and 
 are defined in [ISO10646] to unambiguously separate lines
    and paragraphs, respectively, these do not constitute line breaks in
    HTML, nor does this specification include them in the more general
    category of white space characters.

    ....

    9.3.2 Controlling line breaks

    A line break is defined to be a carriage return (&#x000D, a line feed
    (&#x000A, or a carriage return/line feed pair. All line breaks
    constitute white space.


    B.3.1 Line breaks

    SGML (see [ISO8879], section 7.6.1) specifies that a line break
    immediately following a start tag must be ignored, as must a line break
    immediately before an end tag. This applies to all HTML elements without
    exception.

    The following two HTML examples must be rendered identically:

    Thomas is watching TV.




    Thomas is watching TV.



    So must the following two examples:

    My favorite Website


    My favorite Website





    --
    Glenn -- http://nevcal.com/
    ===========================
    A protocol is complete when there is nothing left to remove.
    -- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

+ Reply to Thread