Merge pull request #28781 from terrymun/master

[@types/jquery] .appendTo() should accept a document fragment as an argument
This commit is contained in:
Jesse Trinity
2018-09-17 15:07:21 -07:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
+3 -2
View File
@@ -21,6 +21,7 @@
// John Reilly <https://github.com/johnnyreilly>
// Dick van den Brink <https://github.com/DickvdBrink>
// Thomas Schulz <https://github.com/King2500>
// Terry Mun <https://github.com/terrymun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -3487,7 +3488,7 @@ interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
* @see \`{@link https://api.jquery.com/appendTo/ }\`
* @since 1.0
*/
appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element> | JQuery): this;
appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element | DocumentFragment> | JQuery): this;
/**
* Set one or more attributes for the set of matched elements.
*
@@ -5078,7 +5079,7 @@ interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
* @see \`{@link https://api.jquery.com/prependTo/ }\`
* @since 1.0
*/
prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element> | JQuery): this;
prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element | DocumentFragment> | JQuery): this;
/**
* Get the immediately preceding sibling of each element in the set of matched elements. If a selector
* is provided, it retrieves the previous sibling only if it matches that selector.
+6
View File
@@ -5670,6 +5670,9 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('span').appendTo($('p'));
// $ExpectType JQuery<HTMLElement>
$('span').appendTo(document.createDocumentFragment());
}
function insertAfter() {
@@ -5733,6 +5736,9 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('span').prependTo($('p'));
// $ExpectType JQuery<HTMLElement>
$('span').prependTo(document.createDocumentFragment());
}
function clone() {