Browse Source

added JQueryHelper to import J/JTHIS globals from

Nicolas Cannasse 12 years ago
parent
commit
59cc6e10f5
1 changed files with 16 additions and 0 deletions
  1. 16 0
      std/js/JQuery.hx

+ 16 - 0
std/js/JQuery.hx

@@ -62,6 +62,22 @@ typedef JqEvent = {
 	function stopPropagation() : Void;
 }
 
+extern class JQueryHelper {
+	@:overload(function(j:JQuery):JQuery{})
+	@:overload(function(j:DOMWindow):JQuery{})
+	@:overload(function(j:Element):JQuery{})
+	public static inline function J( html : String ) : JQuery {
+		return new JQuery(html);
+	}
+	
+	public static var JTHIS(get, null) : JQuery;
+
+	static inline function get_JTHIS() : JQuery {
+		return untyped __js__("$(this)");
+	}
+
+}
+
 @:initPackage
 extern class JQuery implements ArrayAccess<Element> {