Created
August 7, 2012 16:55
Revisions
-
johnjbarton created this gist
Aug 7, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ // Comparing some of the use-cases for 'quasi-literals' aka string templates to normal functions and strings // http://wiki.ecmascript.org/doku.php?id=harmony:quasis#syntax x`foo${bar}baz` // vs x('foo',bar,'baz'); // http://wiki.ecmascript.org/doku.php?id=harmony:quasis#secure_content_generation safehtml`<a href="${url}?q=${query}" onclick=alert(${message}) style="color: ${color}">${message}</a>` // vs safehtml('<a href="',url,'?q=',query,'" onclick=alert(', message,') style="color: ',color,'>',message,'</a>'); // http://wiki.ecmascript.org/doku.php?id=harmony:quasis#text_l10n msg`Welcome to ${siteName}, you are visitor number ${visitorNumber}!` // vs msg('Welcome to ',siteName,', you are visitor number ',visitorNumber,'!');