瀏覽代碼

make JQuery iterator() optional (only if used)

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

+ 6 - 2
std/js/JQuery.hx

@@ -317,7 +317,9 @@ extern class JQuery implements ArrayAccess<Dom.HtmlDom> {
 	//}
 
 	// haXe addition
-	function iterator() : Iterator<JQuery>;
+	@:runtime inline function iterator() : Iterator<JQuery> {
+		return untyped this["iterator"]();
+	}
 
 	/**
 		Return the current JQuery element (in a callback), similar to $(this) in JS.
@@ -348,6 +350,8 @@ extern class JQuery implements ArrayAccess<Dom.HtmlDom> {
 		#end
 		var q : Dynamic = window.jQuery;
 		js.JQuery = q;
-		q.fn.iterator = function() return { pos : 0, j : __this__, hasNext : function() return __this__.pos < __this__.j.length, next : function() return $(__this__.j[__this__.pos++]) };
+		__feature__('js.JQuery.iterator',
+			q.fn.iterator = function() return { pos : 0, j : __this__, hasNext : function() return __this__.pos < __this__.j.length, next : function() return $(__this__.j[__this__.pos++]) }
+		);
 	}
 }