Merge pull request #4160 from rdennis/master

jQuery failsafe syntax
This commit is contained in:
John Reilly
2015-04-23 16:22:06 +01:00
2 changed files with 20 additions and 10 deletions

View File

@@ -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();
$('<p id="test">My <em>new</em> text</p>').appendTo('body');
$('<img />');
@@ -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...
});
}

22
jquery/jquery.d.ts vendored
View File

@@ -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.