Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Free Nodelet gets templating features (', " and \)

by ikegami (Pope)
on Dec 07, 2006 at 02:22 UTC ( #588245=note: print w/ replies, xml ) Need Help??


in reply to Free Nodelet gets templating features

Oddly enough for templating features destined to be used in JavaScript, there's no modifier to interpolate a variable (say `title`) as a JavaScript literal.

For example, neither

var title = '`title`'; # Fails for titles containing ' or \.

nor

var title = "`title`"; # Fails for titles containing " or \.

work for all titles. The workaround:

var title = decodeURIComponent('`title%`');

Update: tye suggested `title"` in a later post.


Comment on Re: Free Nodelet gets templating features (', " and \)
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://588245]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-10-22 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls