Not a bug {xen:jsescape Does not escape some characters

Chris D

XenForo developer
Staff member
I am working on an add-on which has some configurable options in the Admin CP which are then inserted into javascript using the following code:
Code:
{xen:jsescape {xen:raw $xenOptions.myAddOnFullText}}

The default text of my text box contains this, for example.

Code:
<p>The default text of my text box contains HTML which is escaped properly but also doesn't escape apostrophes properly</p>

The source of the page looks like this, for example.

HTML:
<script>fulltext: '<p>The default text of my text box contains HTML which is escaped properly but also doesn't escape apostrophes properly<\/p>'</script>

So the apostrophe isn't escaped, breaking the javascript. In my mind, jsescape should escape the apostrophes properly like it does with the </p> tag.

I am working around this at the moment to have the default text with words such as does not instead of doesn't.
 
I will try it and let you know :)

Just about to release the add-on though so I'll implement it in the next version if it works.
 
Top Bottom