Browse Source

clean up the js.html.compat polyfill code

Andy Li 10 years ago
parent
commit
7ae2b6713d

+ 1 - 1
std/js/html/compat/ArrayBuffer.hx

@@ -53,7 +53,7 @@ class ArrayBuffer {
 	}
 
 	static function __init__() untyped {
-		var ArrayBuffer = untyped __js__("Function(\"return typeof ArrayBuffer != 'undefined' ? ArrayBuffer : null\")()") || js.html.compat.ArrayBuffer;
+		var ArrayBuffer = Function("return typeof ArrayBuffer != 'undefined' ? ArrayBuffer : null")() || js.html.compat.ArrayBuffer;
 		if( ArrayBuffer.prototype.slice == null ) ArrayBuffer.prototype.slice = sliceImpl; // IE10
 	}
 }

+ 2 - 2
std/js/html/compat/DataView.hx

@@ -137,8 +137,8 @@ class DataView {
 		}
 	}
 
-	static function __init__() untyped {
-		var DataView = untyped __js__("Function(\"return typeof DataView != 'undefined' ? DataView : null\")()") || js.html.compat.DataView;
+	static function __init__() {
+		var DataView = untyped Function("return typeof DataView != 'undefined' ? DataView : null")() || js.html.compat.DataView;
 	}
 
 }

+ 2 - 2
std/js/html/compat/Float32Array.hx

@@ -102,8 +102,8 @@ class Float32Array {
 		return a;
 	}
 
-	static function __init__() untyped {
-		var Float32Array = untyped __js__("Function(\"return typeof Float32Array != 'undefined' ? Float32Array : null\")()") || _new;
+	static function __init__() {
+		var Float32Array = untyped Function("return typeof Float32Array != 'undefined' ? Float32Array : null")() || _new;
 	}
 
 }

+ 2 - 2
std/js/html/compat/Float64Array.hx

@@ -109,8 +109,8 @@ class Float64Array {
 		return a;
 	}
 
-	static function __init__() untyped {
-		var Float64Array = untyped __js__("Function(\"return typeof Float32Array != 'undefined' ? (typeof Float64Array != 'undefined' ? Float64Array : 'notsupported') : null\")()") || _new;
+	static function __init__() {
+		var Float64Array = untyped Function("return typeof Float64Array != 'undefined' ? Float64Array : (typeof Float32Array != 'undefined' ? Float32Array : null)")() || _new;
 	}
 
 }

+ 2 - 2
std/js/html/compat/Uint8Array.hx

@@ -93,8 +93,8 @@ class Uint8Array {
 		return a;
 	}
 
-	static function __init__() untyped {
-		var Uint8Array = untyped __js__("Function(\"return typeof Uint8Array != 'undefined' ? Uint8Array : null\")()") || _new;
+	static function __init__() {
+		var Uint8Array = untyped Function("return typeof Uint8Array != 'undefined' ? Uint8Array : null")() || _new;
 	}
 
 }