Loading ...
Sorry, an error occurred while loading the content.

Re: Error in whitespace algorithm (UNCLASSIFIED)

Expand Messages
  • douglascrockford
    ... var o = function () { ........ use strict ; ........var x = { ................large: 0, ................css: { ....................body: botyu
    Message 1 of 2 , Jul 11, 2012
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Cheney, Edward A SFC RES USAR USARC" <austin.cheney@...> wrote:
      >
      > Classification: UNCLASSIFIED
      > This following pattern is what passes in JSLint:
      >
      > var o = function () {
      > ........"use strict";
      > ........var x = {
      > ................large: 0,
      > ................css: {
      > ....................body: "botyu"
      > ................},
      > ................top: "",
      > ................color: "default"
      > ............},
      > ............p = ["wer", "asdf", {
      > ................v: "df",
      > ................r: "sdf"
      > ............}, "rwer", "tyu", {
      > ................q: "yh"
      > ............}
      > ................];
      > ....};
      >
      > The correct pattern, in keeping with the spirit of JSLint, is:
      >
      > var o = function () {
      > ........"use strict";
      > ........var x = {
      > ................large: 0,
      > ................css: {
      > ....................body: "botyu"
      > ................},
      > ................top: "",
      > ................color: "default"
      > ............},
      > ............p = ["wer", "asdf", {
      > ........................v: "df",
      > ........................r: "sdf"
      > ....................}, "rwer", "tyu", {
      > ........................q: "yh"
      > ....................}];
      > ....};
      >
      > The difference is in variable p. A child dimension should be indented in addition to that of its parent. If there are no indexes separating syntax characters of containment then those syntax characters can be collapsed upon each other without separating white space.


      var o = function () {
      ........'use strict';
      ........var x = {
      ................large: 0,
      ................css: {
      ....................body: "botyu"
      ................},
      ................top: "",
      ................color: "default"
      ............},
      ............p = ["wer", "asdf", {
      ................v: "df",
      ................r: "sdf"
      ............}, "rwer", "tyu", {
      ................q: "yh"
      ............}];
      ....};
    Your message has been successfully submitted and would be delivered to recipients shortly.