> On Nov 8, 2026, at 04:30, Greg Huber <[email protected]> wrote:
> 
> I am getting this again, seems flaky.
> 
> From the browser I see
> 
> Uncaught ReferenceError: $ is not defined
> 
> <anonymous>http://www.wikidrinker.co.uk/roller/theme/scripts/roller.js:240
> 
> which is
> 
> $(document).ready(function () {
>     jQuery("form.validate-form").validate();
>     // Added method to check valid email address and add a custom error 
> message
>     jQuery.validator.addMethod(
>         "regex",
>         function(value, element, regexp)  {
>             if (regexp && regexp.constructor != RegExp) {
>                 regexp = new RegExp(regexp);
>             } else if (regexp.global) {
>                 regexp.lastIndex = 0;
>             }
>             return this.optional(element) || regexp.test(value);
>         }
>     );
>     // Applied email rules to field with class name validate-email
>     jQuery( ".validate-email" ).rules( "add", {
>         minlength: 3,
>         maxlength: 255,
>         email: true,
>         regex: /^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i
>     });
> });
> 
> Template :
> 
> roller/app/src/main/webapp/themes/basic/weblog.vm
> 
> There is no jquery?  Is something supposed to inject jquery now?
> 

Hi Greg,

Nothing is meant to inject jQuery on weblog pages, and that error isn't new in 
RC5. The $(document).ready block in roller.js came in with the jQuery 
validation work for the admin UI (ROL-2156) and has been in every release since 
6.1.0. The admin pages load jQuery first, but the comment form in 
WEB-INF/velocity/weblog.vm and popupcomments.vm include roller.js without it, 
so any page showing the comment form logs "$ is not defined". Pages without the 
form don't load roller.js, which may be why it looks flaky.

It's harmless: the block is the last thing in roller.js, so getCookie and the 
comment form scripts still work. The jQuery validation was only meant for admin 
forms.

The fix is to wrap the block in a check for window.jQuery && jQuery.validator, 
or move it into an admin-only script. I'd fix it on master rather than respin 
the RC.

Hope this helps,

Matt


Reply via email to