Procházet zdrojové kódy

Sorted field by name. Added `iterator()`. Correctly handle `fn`.

Andy Li před 10 roky
rodič
revize
386dc55952

+ 19 - 19
std/js/jquery/Callbacks.hx

@@ -2,26 +2,21 @@
 package js.jquery;
 @:final @:native("$.Callbacks") extern class Callbacks {
 	/**
-		Disable a callback list from doing anything more.
-	**/
-	public function disable():js.jquery.Callbacks;
-	/**
-		Remove all of the callbacks from a list.
+		Add a callback or a collection of callbacks to a callback list.
 	**/
-	public function empty():js.jquery.Callbacks;
+	public function add(callbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Callbacks;
 	/**
-		Determine whether or not the list has any callbacks attached. If a callback is provided as an argument, determine whether it is in a list.
+		Disable a callback list from doing anything more.
 	**/
-	public function has(?callback:haxe.Constraints.Function):Bool;
+	public function disable():js.jquery.Callbacks;
 	/**
-		Determine if the callbacks list has been locked.
+		Determine if the callbacks list has been disabled.
 	**/
-	public function locked():Bool;
+	public function disabled():Bool;
 	/**
-		A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
+		Remove all of the callbacks from a list.
 	**/
-	@:selfCall
-	public function new(flags:String):Void;
+	public function empty():js.jquery.Callbacks;
 	/**
 		Call all of the callbacks with the given arguments.
 	**/
@@ -31,21 +26,26 @@ package js.jquery;
 	**/
 	public function fireWith(?context:Dynamic, ?args:Dynamic):js.jquery.Callbacks;
 	/**
-		Add a callback or a collection of callbacks to a callback list.
+		Determine if the callbacks have already been called at least once.
 	**/
-	public function add(callbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Callbacks;
+	public function fired():Bool;
+	/**
+		Determine whether or not the list has any callbacks attached. If a callback is provided as an argument, determine whether it is in a list.
+	**/
+	public function has(?callback:haxe.Constraints.Function):Bool;
 	/**
 		Lock a callback list in its current state.
 	**/
 	public function lock():js.jquery.Callbacks;
 	/**
-		Determine if the callbacks list has been disabled.
+		Determine if the callbacks list has been locked.
 	**/
-	public function disabled():Bool;
+	public function locked():Bool;
 	/**
-		Determine if the callbacks have already been called at least once.
+		A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
 	**/
-	public function fired():Bool;
+	@:selfCall
+	public function new(flags:String):Void;
 	/**
 		Remove a callback or a collection of callbacks from a callback list.
 	**/

+ 27 - 27
std/js/jquery/Deferred.hx

@@ -2,30 +2,17 @@
 package js.jquery;
 @:final @:native("$.Deferred") extern class Deferred {
 	/**
-		Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. 
-	**/
-	public function then(doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise;
-	/**
-		 Add handlers to be called when the Deferred object is rejected. 
-	**/
-	public function fail(failCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?failCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
-	/**
-		 Utility method to filter and/or chain Deferreds.  
-	**/
-	@:overload(function(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise { })
-	public function pipe(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function):js.jquery.Promise;
-	/**
-		 Reject a Deferred object and call any failCallbacks with the given <code>args</code>. 
+		 Add handlers to be called when the Deferred object is either resolved or rejected. 
 	**/
-	public function reject(?args:Dynamic):js.jquery.Deferred;
+	public function always(alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
 	/**
-		 Resolve a Deferred object and call any doneCallbacks with the given <code>context</code> and <code>args</code>. 
+		 Add handlers to be called when the Deferred object is resolved. 
 	**/
-	public function resolveWith(context:Dynamic, ?args:Array<Dynamic>):js.jquery.Deferred;
+	public function done(doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
 	/**
-		 Add handlers to be called when the Deferred object is either resolved or rejected. 
+		 Add handlers to be called when the Deferred object is rejected. 
 	**/
-	public function always(alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
+	public function fail(failCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?failCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
 	/**
 		 A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
 	**/
@@ -40,27 +27,40 @@ package js.jquery;
 	**/
 	public function notifyWith(context:Dynamic, ?args:Array<Dynamic>):js.jquery.Deferred;
 	/**
-		 Add handlers to be called when the Deferred object generates progress notifications.
+		 Utility method to filter and/or chain Deferreds.  
 	**/
-	public function progress(progressCallbacks:haxe.extern.EitherType<haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, Array<Dynamic>>, ?progressCallbacks:haxe.extern.EitherType<haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, Array<Dynamic>>):js.jquery.Deferred;
+	@:overload(function(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise { })
+	public function pipe(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function):js.jquery.Promise;
 	/**
-		 Reject a Deferred object and call any failCallbacks with the given <code>context</code> and <code>args</code>. 
+		 Add handlers to be called when the Deferred object generates progress notifications.
 	**/
-	public function rejectWith(context:Dynamic, ?args:Array<Dynamic>):js.jquery.Deferred;
+	public function progress(progressCallbacks:haxe.extern.EitherType<haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, Array<Dynamic>>, ?progressCallbacks:haxe.extern.EitherType<haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, Array<Dynamic>>):js.jquery.Deferred;
 	/**
 		 Return a Deferred's Promise object. 
 	**/
 	public function promise(?target:Dynamic):js.jquery.Promise;
 	/**
-		Determine the current state of a Deferred object. 
+		 Reject a Deferred object and call any failCallbacks with the given <code>args</code>. 
 	**/
-	public function state():String;
+	public function reject(?args:Dynamic):js.jquery.Deferred;
 	/**
-		 Add handlers to be called when the Deferred object is resolved. 
+		 Reject a Deferred object and call any failCallbacks with the given <code>context</code> and <code>args</code>. 
 	**/
-	public function done(doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
+	public function rejectWith(context:Dynamic, ?args:Array<Dynamic>):js.jquery.Deferred;
 	/**
 		 Resolve a Deferred object and call any doneCallbacks with the given <code>args</code>. 
 	**/
 	public function resolve(?args:Dynamic):js.jquery.Deferred;
+	/**
+		 Resolve a Deferred object and call any doneCallbacks with the given <code>context</code> and <code>args</code>. 
+	**/
+	public function resolveWith(context:Dynamic, ?args:Array<Dynamic>):js.jquery.Deferred;
+	/**
+		Determine the current state of a Deferred object. 
+	**/
+	public function state():String;
+	/**
+		Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. 
+	**/
+	public function then(doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise;
 }

+ 20 - 20
std/js/jquery/Event.hx

@@ -2,51 +2,51 @@
 package js.jquery;
 @:final @:native("$.Event") extern class Event extends js.html.Event {
 	/**
-		The element where the currently-called jQuery event handler was attached.
-	**/
-	public var delegateTarget : js.html.Element;
-	/**
-		The namespace specified when the event was triggered.
+		An optional object of data passed to an event method when the current executing handler is bound.  
 	**/
-	public var namespace : String;
+	public var data : Dynamic;
 	/**
-		For key or mouse events, this property indicates the specific key or button that was pressed.
+		The element where the currently-called jQuery event handler was attached.
 	**/
-	public var which : Float;
+	public var delegateTarget : js.html.Element;
 	/**
-		  Returns whether <a href="/event.stopPropagation/">event.stopPropagation()</a> was ever called on this event object. 
+		Returns whether <a href="/event.preventDefault/">event.preventDefault()</a> was ever called on this event object. 
 	**/
-	public function isPropagationStopped():Bool;
+	public function isDefaultPrevented():Bool;
 	/**
 		  Returns whether event.stopImmediatePropagation() was ever called on this event object. 
 	**/
 	public function isImmediatePropagationStopped():Bool;
 	/**
-		An optional object of data passed to an event method when the current executing handler is bound.  
+		  Returns whether <a href="/event.stopPropagation/">event.stopPropagation()</a> was ever called on this event object. 
 	**/
-	public var data : Dynamic;
+	public function isPropagationStopped():Bool;
 	/**
 		Indicates whether the META key was pressed when the event fired.
 	**/
 	public var metaKey : Bool;
 	/**
-		The other DOM element involved in the event, if any.
+		The namespace specified when the event was triggered.
 	**/
-	public var relatedTarget : js.html.Element;
+	public var namespace : String;
 	/**
 		The mouse position relative to the left edge of the document.
 	**/
 	public var pageX : Float;
 	/**
-		The last value returned by an event handler that was triggered by this event, unless the value was <code>undefined</code>.
+		The mouse position relative to the top edge of the document.
 	**/
-	public var result : Dynamic;
+	public var pageY : Float;
 	/**
-		Returns whether <a href="/event.preventDefault/">event.preventDefault()</a> was ever called on this event object. 
+		The other DOM element involved in the event, if any.
 	**/
-	public function isDefaultPrevented():Bool;
+	public var relatedTarget : js.html.Element;
 	/**
-		The mouse position relative to the top edge of the document.
+		The last value returned by an event handler that was triggered by this event, unless the value was <code>undefined</code>.
 	**/
-	public var pageY : Float;
+	public var result : Dynamic;
+	/**
+		For key or mouse events, this property indicates the specific key or button that was pressed.
+	**/
+	public var which : Float;
 }

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 443 - 449
std/js/jquery/JQuery.hx


+ 20 - 0
std/js/jquery/JqIterator.hx

@@ -0,0 +1,20 @@
+package js.jquery;
+
+class JqIterator {
+	var j:JQuery;
+	var i:Int;
+	inline public function new(j:JQuery):Void {
+		this.i = 0;
+		this.j = j;
+	}
+	inline public function hasNext():Bool {
+		return i < j.length;
+	}
+	inline public function next():js.html.Element {
+		return this.j[i++];
+	}
+
+	static function __init__() {
+		JQuery.fn.iterator = function() return new JqIterator(js.Lib.nativeThis);
+	}
+}

+ 8 - 8
std/js/jquery/JqXHR.hx

@@ -2,9 +2,13 @@
 package js.jquery;
 @:final @:native("$.JqXHR") extern class JqXHR extends js.html.XMLHttpRequest {
 	/**
-		Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. 
+		 Add handlers to be called when the Deferred object is either resolved or rejected. 
 	**/
-	public function then(doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise;
+	public function always(alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
+	/**
+		 Add handlers to be called when the Deferred object is resolved. 
+	**/
+	public function done(doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
 	/**
 		 Add handlers to be called when the Deferred object is rejected. 
 	**/
@@ -14,10 +18,6 @@ package js.jquery;
 	**/
 	@:overload(function(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise { })
 	public function pipe(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function):js.jquery.Promise;
-	/**
-		 Add handlers to be called when the Deferred object is either resolved or rejected. 
-	**/
-	public function always(alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
 	/**
 		 Add handlers to be called when the Deferred object generates progress notifications.
 	**/
@@ -27,7 +27,7 @@ package js.jquery;
 	**/
 	public function state():String;
 	/**
-		 Add handlers to be called when the Deferred object is resolved. 
+		Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. 
 	**/
-	public function done(doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
+	public function then(doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise;
 }

+ 8 - 8
std/js/jquery/Promise.hx

@@ -2,9 +2,13 @@
 package js.jquery;
 @:final @:native("$.Promise") typedef Promise = {
 	/**
-		Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. 
+		 Add handlers to be called when the Deferred object is either resolved or rejected. 
 	**/
-	public function then(doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise;
+	public function always(alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
+	/**
+		 Add handlers to be called when the Deferred object is resolved. 
+	**/
+	public function done(doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
 	/**
 		 Add handlers to be called when the Deferred object is rejected. 
 	**/
@@ -14,10 +18,6 @@ package js.jquery;
 	**/
 	@:overload(function(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise { })
 	public function pipe(?doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function):js.jquery.Promise;
-	/**
-		 Add handlers to be called when the Deferred object is either resolved or rejected. 
-	**/
-	public function always(alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?alwaysCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
 	/**
 		 Add handlers to be called when the Deferred object generates progress notifications.
 	**/
@@ -27,7 +27,7 @@ package js.jquery;
 	**/
 	public function state():String;
 	/**
-		 Add handlers to be called when the Deferred object is resolved. 
+		Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. 
 	**/
-	public function done(doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>, ?doneCallbacks:haxe.extern.EitherType<haxe.Constraints.Function, Array<haxe.Constraints.Function>>):js.jquery.Deferred;
+	public function then(doneFilter:haxe.Constraints.Function, ?failFilter:haxe.Constraints.Function, ?progressFilter:haxe.Constraints.Function):js.jquery.Promise;
 }

+ 5 - 0
tests/unit/src/unit/TestJQuery.hx

@@ -17,6 +17,11 @@ class TestJQuery extends Test {
         });
     }
 
+    function testIterator() {
+        var div = Lambda.find(new JQuery("<div></div>"), function(ele) return ele.tagName == "div");
+        eq(div.tagName, "div");
+    }
+
     function testHelper() {
         var j = J("<div id='test'></div>");
         j.each(function(i,e){

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů