Hi Dan, Can you post a URL to a page that includes the smallest amount of code to reproduce this issue?
Cheers, - Jonathan On Tue, Apr 7, 2009 at 2:44 PM, DynamoDan <dhaart...@gmail.com> wrote: > > Hi All > > I've used jQuery a lot over the years, mostly in the joomla CMS > context. I think I've found a bug in this function: > > // Evalulates a script in a global context > globalEval: function( data ) { > > The problem is that if there is a newline inside of a string literal > (single quoted) in `data`, then the script fails with an "unterminated > string literal" error. The first thing done to `data` in this > function is this (jQuery 1.2.6): > > data = jQuery.trim( data ); > > But, this trim function only removes leading and trailing whitespace > using a regex, and not with the s modifier to include newlines > matching the \s character class. > > jQuery 1.3.2 omits this call to jQuery.trim, and still exhibits the > "unterminated string literal" error when `data` contains a newline > inside of single quotes. > > I don't know what the solution should be for sure, but for my own > purposes I've added this line to globalEval before anything is done > with `data`: > > data = data.replace(/[\r\n\f]+/g, ' '); > > It works on data that contains carriage returns, newlines, or form > feed characters, since these (well, at least the newline) don't work > inside single quotes, when evaluated as a javascript. > > Love to hear if anyone else has had this problem. > >