Problem with jQuery UI

Sep 23, 2009 at 2:28 PM

I tried to add the full version of the jQuery UI javascript (http://jqueryui.com/download) to my resourceset, but it doesn't work. This is the error that firebug reports:

invalid object initializer
(function(){var J=/((?:\((?:\([^()]+\)|[...ring(h.length+1));break;}}}return f;}};\n

If i add the javascript-file with a <script src=...>, it all works fine.

I then downloaded the source for the MVC.ResourceCombine-project and changes this line:

return JavaScriptCompressor.Compress(content,
                                     false  /* isVerboseLogging */,
                                     true   /* isObfuscateJavascript */,
                                     false  /* preserveAllSemicolons */,
                                     false  /* disableOptimizations */,
                                     -1     /* lineBreakPosition */,
                                     Encoding.UTF8,
                                     CultureInfo.CurrentCulture);

into this:

 

return JavaScriptCompressor.Compress(content,
                                     false  /* isVerboseLogging */,
                                     true   /* isObfuscateJavascript */,
                                     false  /* preserveAllSemicolons */,
                                     false  /* disableOptimizations */,
                                     -1);   /* lineBreakPosition */

 

and then my resourceset works with jQuery UI included. I have no idea why, i'm kinda new to MVC and everything .net, but i thought i should mention it since you're still in beta :)

Coordinator
Oct 29, 2009 at 4:29 PM

Thanks for noticing.  I'll investigate the update the code if necessary.  Will let you know.

 

Coordinator
Oct 30, 2009 at 6:53 AM

I tested with jQuery UI 1.7.2 and can't reproduce this error.  I'm going to create a sample project using jQuery UI (both script & CSS), you can download & check. 

Coordinator
Oct 31, 2009 at 7:31 AM

The latest development code (Combres 1.0 beta) has a sample MVC project using jQuery UI.  It works without problem.

Dec 5, 2009 at 12:08 AM

First of all, thanks for a really useful library.

I had to change

return JavaScriptCompressor.Compress(content,
false /* isVerboseLogging */,
true /* isObfuscateJavascript */,
false /* preserveAllSemicolons */,
false /* disableOptimizations */,
-1 /* lineBreakPosition */,
Encoding.UTF8,
CultureInfo.CurrentCulture);

to

return JavaScriptCompressor.Compress(content,
false /* isVerboseLogging */,
true /* isObfuscateJavascript */,
false /* preserveAllSemicolons */,
false /* disableOptimizations */,
-1 /* lineBreakPosition */,
Encoding.UTF8,
CultureInfo.InvariantCulture);

to get it to work. My current culture uses comma as decimal separator, which apparently broke the jQuery UI plugin. Probably due to that YUI js compressor parsed and replaced decimal numbers, e g 1.9 > 1,9.

Coordinator
Dec 5, 2009 at 9:26 AM

@matr0145:

Thanks a lot for reporting the issue.  I've modified the code, which is the same to what you suggested, in the latest code commit http://combres.codeplex.com/SourceControl/ListDownloadableCommits.aspx.