diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts
index 006140f2fd..3853a8d5f9 100644
--- a/jquery/jquery-tests.ts
+++ b/jquery/jquery-tests.ts
@@ -2511,10 +2511,10 @@ function test_jQuery() {
$foo.triggerHandler('eventName');
$("div > p").css("border", "1px solid gray");
$("input:radio", document.forms[0]);
- var xml: any;
+ var xml: any;
$("div", xml.responseXML);
$(document.body).css("background", "black");
- var myForm: any;
+ var myForm: any;
$(myForm.elements).hide();
$('
My new text
').appendTo('body');
$('
');
@@ -2537,6 +2537,10 @@ function test_jQuery() {
}
}).appendTo("body");
jQuery(function ($) {
+ // Your code using failsafe $ alias here...
+ });
+ jQuery(document).ready(function ($) {
+ // Your code using failsafe $ alias here...
});
}
diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts
index 61fd624422..6a7bc47c2e 100644
--- a/jquery/jquery.d.ts
+++ b/jquery/jquery.d.ts
@@ -725,30 +725,42 @@ interface JQueryStatic {
* @param context A DOM Element, Document, or jQuery to use as context
*/
(selector: string, context?: Element|JQuery): JQuery;
+
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param element A DOM element to wrap in a jQuery object.
*/
(element: Element): JQuery;
+
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param elementArray An array containing a set of DOM elements to wrap in a jQuery object.
*/
(elementArray: Element[]): JQuery;
+
+ /**
+ * Binds a function to be executed when the DOM has finished loading.
+ *
+ * @param callback A function to execute after the DOM is ready.
+ */
+ (callback: (jQueryAlias?: JQueryStatic) => any): JQuery;
+
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param object A plain object to wrap in a jQuery object.
*/
(object: {}): JQuery;
+
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param object An existing jQuery object to clone.
*/
(object: JQuery): JQuery;
+
/**
* Specify a function to execute when the DOM is fully loaded.
*/
@@ -761,6 +773,7 @@ interface JQueryStatic {
* @param ownerDocument A document in which the new elements will be created.
*/
(html: string, ownerDocument?: Document): JQuery;
+
/**
* Creates DOM elements on the fly from the provided string of raw HTML.
*
@@ -769,13 +782,6 @@ interface JQueryStatic {
*/
(html: string, attributes: Object): JQuery;
- /**
- * Binds a function to be executed when the DOM has finished loading.
- *
- * @param callback A function to execute after the DOM is ready.
- */
- (callback: Function): JQuery;
-
/**
* Relinquish jQuery's control of the $ variable.
*
@@ -2352,7 +2358,7 @@ interface JQuery {
*
* @param handler A function to execute after the DOM is ready.
*/
- ready(handler: Function): JQuery;
+ ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery;
/**
* Trigger the "resize" event on an element.