Browse Source

make sure we don't redefine another version of JQuery when embedding it automatically

Nicolas Cannasse 13 years ago
parent
commit
caa013e813
1 changed files with 2 additions and 1 deletions
  1. 2 1
      std/js/JQuery.hx

+ 2 - 1
std/js/JQuery.hx

@@ -346,7 +346,8 @@ extern class JQuery implements ArrayAccess<Dom.HtmlDom> {
 
 
 	private static function __init__() : Void untyped {
 	private static function __init__() : Void untyped {
 		#if !noEmbedJS
 		#if !noEmbedJS
-		haxe.macro.Tools.includeFile("js/jquery-latest.min.js");
+		if( untyped __js__("typeof($) == 'undefined'") )
+			haxe.macro.Tools.includeFile("js/jquery-latest.min.js");
 		#end
 		#end
 		var q : Dynamic = window.jQuery;
 		var q : Dynamic = window.jQuery;
 		js.JQuery = q;
 		js.JQuery = q;