nextwebgen.com

The Next Generation Web Now

Secure String Interpolation in JavaScript

Filed under: Web 2.0 News — Dion Almaer at 9:46 am on Thursday, January 31, 2008

Mike Samuel of the Google Caja team (and much more) has a fantastically detailed document on the choices for secure String interpolation in JavaScript.

He spends a lot of time discussing:

There are a large number of examples a long the way:

JAVASCRIPT:

  1.  
  2. var ids = [1, 2, 3, 4];
  3. var column = ‘value’;
  4. var foo = ‘foo’;
  5.  
  6. open(Template(“SELECT $column FROM Table WHERE id IN $ids AND foo LIKE $foo”))
  7. // === "SELECT `value` FROM Table WHERE id IN (1, 2, 3, 4) AND foo LIKE ‘foo’"
  8.  
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blogmarks
  • del.icio.us
  • De.lirio.us
  • digg
  • NewsVine
  • YahooMyWeb

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>