[jquery] Change all HTMLElement to be Element (#29282)

* [jquery] Change all `HTMLElement` to be `Element`

* [jquery/v2] remove wrong `parseHTML` overload
This commit is contained in:
boriskor
2018-10-03 21:53:04 +03:00
committed by Wesley Wigham
parent c066174151
commit 823da0de4e
2 changed files with 12 additions and 14 deletions

View File

@@ -824,7 +824,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.ajaxTransport/}
*/
ajaxTransport(dataType: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
ajaxSettings: JQueryAjaxSettings;
/**
@@ -1403,16 +1403,6 @@ interface JQueryStatic {
*/
unique<T extends Element>(array: T[]): T[];
/**
* Parses a string into an array of DOM nodes.
*
* @param data HTML string to be parsed
* @param context DOM element to serve as the context in which the HTML fragment will be created
* @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
* @see {@link https://api.jquery.com/jQuery.parseHTML/}
*/
parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[];
/**
* Parses a string into an array of DOM nodes.
*
@@ -3286,7 +3276,7 @@ interface JQuery {
* @name toArray
* @see {@link https://api.jquery.com/toArray/}
*/
toArray(): HTMLElement[];
toArray(): Element[];
/**
* Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
@@ -3353,13 +3343,13 @@ interface JQuery {
* @param index A zero-based integer indicating which element to retrieve.
* @see {@link https://api.jquery.com/get/#get-index}
*/
get(index: number): HTMLElement;
get(index: number): Element;
/**
* Retrieve the elements matched by the jQuery object.
* @alias toArray
* @see {@link https://api.jquery.com/get/#get}
*/
get(): HTMLElement[];
get(): Element[];
/**
* Search for a given element from among the matched elements.

View File

@@ -3554,3 +3554,11 @@ function test_promise_then_not_return_deferred() {
promise = promise.fail();
promise = promise.always();
}
function test_element() {
const itemEl = $('#item')[0];
$('li').toArray().indexOf(itemEl);
$('li').get().indexOf(itemEl);
let otherItemEl = $('li').get(0);
otherItemEl = itemEl;
}