瀏覽代碼

don't use Object.create() (test fail on IE9)

Nicolas Cannasse 13 年之前
父節點
當前提交
6136e1db0f
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 3 3
      std/js/_std/Hash.hx
  2. 3 3
      std/js/_std/IntHash.hx

+ 3 - 3
std/js/_std/Hash.hx

@@ -28,7 +28,7 @@
 	private var h : Dynamic;
 
 	public function new() : Void {
-		h = untyped ( Object.create != null ) ? Object.create(null) : {};
+		h = {};
 	}
 
 	public function set( key : String, value : T ) : Void {
@@ -40,12 +40,12 @@
 	}
 
 	public function exists( key : String ) : Bool {
-		return untyped Object.prototype.hasOwnProperty.call(h,"$"+key);
+		return untyped h.hasOwnProperty("$"+key);
 	}
 
 	public function remove( key : String ) : Bool {
 		key = "$"+key;
-		if( untyped !Object.prototype.hasOwnProperty.call(h,key) ) return false;
+		if( untyped !h.hasOwnProperty(key) ) return false;
 		untyped __js__("delete")(h[key]);
 		return true;
 	}

+ 3 - 3
std/js/_std/IntHash.hx

@@ -28,7 +28,7 @@
 	private var h : Dynamic;
 
 	public function new() : Void {
-		h = untyped ( Object.create != null ) ? Object.create(null) : {};
+		h = {};
 	}
 
 	public function set( key : Int, value : T ) : Void {
@@ -40,11 +40,11 @@
 	}
 
 	public function exists( key : Int ) : Bool {
-		return untyped Object.prototype.hasOwnProperty.call(h,key);
+		return untyped h.hasOwnProperty(key);
 	}
 
 	public function remove( key : Int ) : Bool {
-		if( untyped !Object.prototype.hasOwnProperty.call(h,key) ) return false;
+		if( untyped !h.hasOwnProperty(key) ) return false;
 		untyped  __js__("delete")(h[key]);
 		return true;
 	}