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

/*properties*/ - Two questions

Expand Messages
  • Erik Eckhardt
    Douglas, I started using the /*properties */ directive and like what it does, though it s making some things a little labor-intensive. 1. It would be very nice
    Message 1 of 1 , Jul 18, 2011
    View Source
    • 0 Attachment
      Douglas,

      I started using the /*properties */ directive and like what it does, though
      it's making some things a little labor-intensive.

      1. It would be very nice with objects to specify the type of item expected
      at the object level, instead of declaring the type of each property item
      explicitly. Consider this example:

      /*properties
      '1': object,
      '2': object,
      statuses: object
      */

      var scopeobject = {
      statuses: {'1': 'edit', '2': 'cancel'}
      };

      I'm sure that as usual I'm missing something important, but I wonder if you
      could support the properties declaration like so instead:

      /*properties
      statuses: object object
      */

      This would mean, let me implicitly have all the properties I want, but
      ensure they are all objects. Some of my code is generated from a database
      dynamically (I run .js files through the ASP parser) and this portion of the
      code I am NOT worried about being correct, but I'd like to be able to make
      changes in the database that don't break JSLint's report just because a new
      property was used.

      2. I have the "assume a browser" and "Assume console, alert, ..." options
      checked, but JSLint is still complaining about properties of DOM objects
      such as document.forms, element.className, and element.onbeforeunload.

      Is there any way these can be implicitly defined with the browser so that
      when defining properties they can be ignored or known? Alternately, is there
      a way to use a properties declaration but optionally not require all
      properties to be defined? I'm using the properties declaration to avoid type
      confusion errors, yet as soon as I do then I'm constantly running up against
      new DOM property names as I develop my code. Building them all and including
      them at the top of each js file is too much for me. If it's too much for
      you, too, then perhaps there can be an explicit/implicit properties mode as
      I suggested.

      Thank you,

      Erik


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.