Browse Source

trace output fallback on console.log

Nicolas Cannasse 14 years ago
parent
commit
6c84934ac8
2 changed files with 6 additions and 5 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 5 5
      std/js/Boot.hx

+ 1 - 0
doc/CHANGES.txt

@@ -10,6 +10,7 @@
 	macro : added TLazy for not-yet-typed class fields
 	js/php/neko : added haxe.web.Request
 	all : added Std.format
+	js : trace() output fallback on console.log if no id="haxe:trace"
 
 2011-09-25: 2.08
 	js : added js.JQuery

+ 5 - 5
std/js/Boot.hx

@@ -37,12 +37,12 @@ class Boot {
 			msg += __string_rec(v,"");
 			fl.trace(msg);
 			#else
-			msg += __unhtml(__string_rec(v,""))+"<br/>";
+			msg += __string_rec(v,"");
 			var d = document.getElementById("haxe:trace");
-			if( d == null )
-				alert("No haxe:trace element defined\n"+msg);
-			else
-				d.innerHTML += msg;
+			if( d != null )
+				d.innerHTML += __unhtml(msg)+"<br/>";
+			else if( __js__("typeof")(console) != "undefined" && console.log != null )
+				console.log(msg);
 			#end
 		}
 	}