Fix issue with WCF.Template.Compiled and newlines
authorTim Düsterhus <timwolla@arcor.de>
Sun, 12 Feb 2012 12:12:14 +0000 (13:12 +0100)
committerTim Düsterhus <timwolla@arcor.de>
Sun, 12 Feb 2012 12:12:14 +0000 (13:12 +0100)
wcfsetup/install/files/js/WCF.js

index 32737b7132b3f1cf98863ed7e7b8f816085cb30a..7b48e9245fe53c652687b5d2ea183836336345a3 100644 (file)
@@ -2403,6 +2403,9 @@ WCF.Template.prototype = {
                // insert delimiter tags
                $compiled = $compiled.replace('{ldelim}', '{').replace('{rdelim}', '}');
                
+               // escape newlines
+               $compiled = $compiled.replace(/(\r\n|\n|\r)/g, '\\n');
+               
                // and re-insert saved literals
                return new WCF.Template.Compiled("'" + this.insertLiterals($compiled) + "';");
        }