Download & Extend

Improper way of adding JS causes 'jQuery is undefined'

Project:GMap Module
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

some1 on IRC was getting the 'jQuery is undefined' error caused by this mess:

<?php
  $o
.= '<script type="text/javascript">'."\n";
 
$o .= "/* <![CDATA[ */\n";
 
$o .= 'jQuery.extend(true, Drupal, { settings: '. drupal_to_js(array('gmap' => array($element['#map'] => $map))) ." });\n";
 
$o .= "/* ]]> */\n";
 
$o .= "</script>\n";
?>

this is not how we add js

attached patch tries to fix that by wrapping it in (function($){ ... })(jQuery) and adding it with a drupal_add_js() with inline as second argument and should apply to current HEAD

AttachmentSize
gmap.patch886 bytes

Comments

#1

Yeah, thanks, it was me1 :)

#2

Status:active» needs review

every friggin time I forget status -_-

#3

+1, I was bit by this bug also. The patch did the trick!

#4

#5

Status:needs review» closed (duplicate)

o wow, how did I not find that?

this patch is a lot cleaner than mine aswel, what was I thinking? :x