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

Should JSLint flag window.execScript as evil?

Expand Messages
  • kevin_hakanson
    I probably will get flamed for using eval to set global variables, but I needed it at the time. Using eval in IE didn t work as I needed, so I had to use the
    Message 1 of 1 , Jun 30, 2008
    View Source
    • 0 Attachment
      I probably will get flamed for using eval to set global variables, but
      I needed it at the time.

      Using eval in IE didn't work as I needed, so I had to use the IE
      specific window.execScript. I found this tip in a comment to a blog
      post ("Sandboxing JavaScript Using <iframe>"), about how to "eval" in
      the global scope synchronously. It contains code that works across
      browsers, and does so by testing the runtime execution and not
      sniffing the User Agent.
      http://dean.edwards.name/weblog/2006/11/sandbox/?full#comment70076

      So, my question is should JSLint check for window.execScript if
      (option.browser && !option.evil) and warn that "window.execScript is
      evil"? I realize that this is an IE specific check, but I thought it
      was at least worth suggesting.
    Your message has been successfully submitted and would be delivered to recipients shortly.