Improper way of adding JS causes 'jQuery is undefined'

seutje - November 3, 2009 - 13:59
Project:GMap Module
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

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

#1

OnkelTem - November 3, 2009 - 14:01

Yeah, thanks, it was me1 :)

#2

seutje - November 3, 2009 - 14:02
Status:active» needs review

every friggin time I forget status -_-

 
 

Drupal is a registered trademark of Dries Buytaert.