Commit Graph
195 Commits
Author SHA1 Message Date
AndyandGitHub 141d1cc870 And tslint disables for no-angle-bracket-type-assertion (#30592) 2018-11-16 12:20:58 -08:00
AndyandGitHub 307a9a0181 jquery: Add no-unnecessary-type-assertion disables (#30319) 2018-11-06 11:26:42 -08:00
Leonard ThieuandSheetal Nandi c6fe757c0d [jquery] Fix TContext declaration of jQuery.proxy on wrong value's type. (#29930)
* [jquery] Match parameter names to documentation more closely.

* [jquery] Add documentation to parameters.

* [jquery] Fix `TContext` declaration on wrong value's type.

Declaring `this` as `TContext` on the input function ensures that it can handle having its context changed to `TContext`. Declaring `this` on the output function is not important because the function will be already defined. It can also get in the way when passing a callback to a function whose callback parameter has `this` declared.

* [jquery] Drop constraint from `TContext`.

It's not really necessary and it is possible to pass primitives as the context.
2018-10-22 09:28:30 -07:00
Leonard ThieuandSheetal Nandi 59b32e5353 [jquery] Add self-extending overloads of jQuery.extend(). (#29924) 2018-10-22 09:25:28 -07:00
Leonard ThieuandSheetal Nandi 5348b35343 [jquery] Split up declarations to stay under GitHub limits. Improve documentation. (#29831)
* [jquery] Split `JQueryStatic` into its own file.

* [jquery] Split `JQuery` into its own file.

* [jquery] Split `JQuery` namespace into its own file.

* [jquery] Split legacy types into their own file.

* [jquery] Remove hard line breaks from documentation descriptions.

WebStorm treats line breaks in descriptions as line breaks when rendering descriptions in tooltips. This causes unintentional early wrapping of text.

* [jquery] Remove extra line after descriptions.

* [jquery] Audit lint rules.

* [jquery] Improve documentation for API methods which have had their signatures unified.
2018-10-18 09:23:20 -07:00
Leonard ThieuandSheetal Nandi bbf1adeeac [jquery] Add preDispatch and postDispatch methods. Fix weak type issues. (#29750)
* [jquery] Add `preDispatch` and `postDispatch` methods.

See https://github.com/jquery/api.jquery.com/issues/752.

* [jquery] Fix weak type issue for `SpecialEventHook`.

* [jquery] Fix weak type issue for `FixHook`.

* [jquery] Add interface for `jQuery.valHooks`.

* [jquery] Fix weak type issue for `ValHook`.

* [jquery] Add interface for `jQuery.cssHooks`.

* [jquery] Properties on `CSSHook` are optional.

* [jquery] Use polymorphic `this` for `settings` parameter.

* [jquery] Wrap `StatusCodeCallbacks` in a region.

* [jquery] Split `@since` tag for consistency.
2018-10-16 14:42:42 -07:00
Leonard ThieuandSheetal Nandi c3cbb348e2 [jquery] Add includeMargin parameter to .outerHeight() and .outerWidth() setters. (#29756)
* [jquery] Add `includeMargin` parameter to `.outerHeight()` and `.outerWidth()` setters.

See https://github.com/jquery/jquery/blob/354f6036f251a3ce9b24cd7b228b4c7a79001520/test/unit/dimensions.js#L477-L484.

* [jquery-awesome-cursor] Add missing `dom` lib target.

* [jquery-toast-plugin] Add missing `dom` lib target.

* [jquery.growl] Add missing `dom` lib target.

* [materialize-css] Disable `unified-signatures` rule for plugin overloads.

These overloads follow the jQuery plugin pattern and are effectively separate methods.

* [ng-cordova] Update promise types to be compatible with changes from `ng.IPromise`.

Ref: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23115

* [ng-tags-input] Add missing `dom` lib target.

* [p-loading] Add missing `dom` lib target.

* [summernote] Add missing `dom` lib target.

* [swig-email-templates] Add missing `dom` lib target.

* [materialize-css] Unify signatures according to feedback.

See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29756#pullrequestreview-165249412.
2018-10-16 10:15:06 -07:00
Leonard ThieuandAndy 1cfcb1ad3b [jquery] Add Animation API. Fix weak type issue for jQuery.speed. (#29712)
* [jquery] Add Animation API.

See https://blog.jquery.com/2012/08/09/jquery-1-8-released/.

* [jquery] Organize Effects section.

* [jquery] Fix weak type issue for `jQuery.speed`.

* [jquery] Fix minor documentation issues.

* [jquery] `stop` and `timer` don't need to be properties.
2018-10-15 17:47:42 -07:00
Leonard ThieuandAndy 20529b02e1 [jquery] Add event extensions API. (#29687)
* [jquery] Add event extensions API.

See https://learn.jquery.com/events/event-extensions/.

* [jquery] Make the errors go away.
2018-10-12 14:23:07 -07:00
Leonard ThieuandAndy 86fd332d85 [jquery] Remove removed parameters from EasingMethod. (#29663)
These were never available in jQuery 3.0+.
2018-10-11 14:26:08 -07:00
Leonard ThieuandAndy abbce5d159 [jquery] Documentation improvements (#29658)
* [jquery] Fix code for example not rendering in VS Code autocomplete.

VS Code does not render the code block of the last example in the autocomplete tooltip (but does in the hover tooltip). This is fixed by adding an additional line terminated by a zero-width space. There doesn't appear to be an obvious pattern to what causes this and there may be other incidences of this bug in the declarations.

* [jquery] Improve formatting of documentation for unified signatures in tooltips.

Documentation for unified signatures is also unified. This means that documentation for a parameter will contain documentation from all the parameters that it's composed of. VS Code and WebStorm render this as one continuous line. This makes it confusing as it's not obvious which parts of documentation apply to a parameter.

To remedy this, parameters are formatted as a bulletted list. `<br>` tags are necessary to force line breaks in WebStorm. The list also cannot start on the first line. To force the first line break, the `<br>` tag is used for WebStorm. For VS Code, a non-empty body must follow the parameter name on its line. A Braille Pattern Blank could be used here but to provide a more intuitive and consistent experience, VS Code's format for rendering parameter info is mimicked instead. The `@` symbol must be encoded to prevent `@param` from being parsed as a JSDoc tag.

Note: VS Code renders the `<br>` tags literally and there does not appear to be a way to hide them.
2018-10-11 11:45:40 -07:00
Leonard ThieuandAndy d883a9fd50 [jquery] Documentation improvements. Add jQuery.cleanData and overloads for jQuery.getScript and Data APIs. (#29573)
* [jquery] Introduce interface for `jQuery.fx`.

* [jquery] Attach `jQuery.Deferred` documentation to correct symbol.

* [jquery] Convert `jQuery.Callbacks` to an interface.

This change is purely for consistency with similar properties (e.g. `jQuery.Deferred`, `jQuery.Event`).

* [jquery] For `JQuery`, reduce examples to only those relevant to the overload and use shorter template for code-only examples.

* [jquery] For `JQueryStatic`, reduce examples to only those relevant to the overload and use shorter template for code-only examples.

* [jquery] For `JQuery.Event`, reduce examples to only those relevant to the overload and use shorter template for code-only examples.

* [jquery] For `JQuery.Callbacks`, reduce examples to only those relevant to the overload and use shorter template for code-only examples.

* [jquery] For `JQuery.PromiseBase`/`JQuery.Deferred`, reduce examples to only those relevant to the overload and use shorter template for code-only examples.

* [jquery] Consistent ordering.

* [jquery] Add `jQuery.getScript(options)`.

See https://github.com/jquery/api.jquery.com/issues/1052.

* [jquery] Fix documentation for this one overload of `jQuery.proxy`.

* [jquery] Accept `Document`, `Window`, and `JQuery.PlainObject` for the `element` parameter of Data APIs.

See https://github.com/jquery/jquery/blob/354f6036f251a3ce9b24cd7b228b4c7a79001520/test/unit/data.js#L142-L164 and https://github.com/jquery/api.jquery.com/issues/1035.

* [jquery] Add `jQuery.cleanData`.

See https://github.com/jquery/api.jquery.com/issues/996.
2018-10-09 08:34:57 -07:00
Leonard ThieuandAndy acbdedd544 [jquery] Copied event properties are writable. (#29520)
* [jquery] Fix indentation.

* [jquery] Copied event properties are writable.

* [jquery] Formatting. Arrange `Event` members according to origin.
2018-10-08 09:03:01 -07:00
Leonard ThieuandJohn Reilly 1c988f15eb [jquery][sizzle] Add detailed deprecation notices and jQuery.nodeName(), jQuery.expr, and jQuery.easing. (#29503)
* [jquery] Add detailed deprecation notices.

* [jquery] Add `jQuery.nodeName()`.

* [sizzle] Add named interfaces for `Selectors` properties.

* [jquery] Add `jQuery.expr`.

* [jquery] Add `jQuery.easing`.

* [jquery] Improve formatting of `@deprecated` tags.

WebStorm will not add padding between the description and deprecated text. To improve readability, a zero-width space and space is added to deprecated text to force padding.

VS Code will collapse white space causing detailed deprecation notices to start adjacent to the `@deprecated` tag if there is no header. A minimal header is added where necessary.

WebStorm renders line breaks in JSDoc. This may cause unintentional wrapping of text for `@deprecated` tags. To avoid this, line breaks are not used in deprecated text unless it's intended to render a line break there.

This also fixes broken non-http `@link` tags and ensures that they render consistently.
2018-10-06 21:46:18 +01:00
boriskorandWesley Wigham 823da0de4e [jquery] Change all HTMLElement to be Element (#29282)
* [jquery] Change all `HTMLElement` to be `Element`

* [jquery/v2] remove wrong `parseHTML` overload
2018-10-03 11:53:04 -07:00
Leonard ThieuandWesley Wigham 7c0825a58c [jquery] Drop type guards from isNumeric()/isPlainObject() and improve declarations of jQuery.data()/.data()/jQuery.css() (#29381)
* [jquery] `isNumeric` can not be a user defined type guard.

`isNumeric` can return true for strings in addition to numbers, but only for a subset of either. It'll return false for NaN (which TypeScript treats as a number) and for strings which cannot be parsed as a number.

* [jquery] `isPlainObject` can not be a user defined type guard.

Due to the imprecise way with how `PlainObject` is declared, `isPlainObject` can not be a user defined type guard.

* [jquery] Use https for links.

* [jquery] Fix link for `JQuery.jquery`.

* [jquery] Remove empty line before `@deprecated`.

For consistent formatting since examples were added.

* [jquery] Document additional `extend` parameters.

* [jquery] Improve declarations of `data()` to catch unintentionally passing `undefined` as a value.

This handles the more likely case of users passing a value that is possibly undefined.

* [jquery] Improve declaration of `css()`.

* [jquery] Minor improves to `proxy()` documentation.

* [jquery] Fix region folding for WebStorm.

WebStorm uses `// #region` to designate a region start while VS Code uses `// region`. They can both (must, in this case) be terminated using `// #endregion`. Using both `// #endregion` and `// endregion` results in odd behavior in both editors.
2018-10-02 11:37:07 -07:00
Leonard ThieuandWesley Wigham e81760c6f8 [jquery] trigger/triggerHandler accept boolean values for extraParameters. (#29286)
See https://liveweave.com/BTLAFI
2018-10-01 20:58:32 -07:00
Leonard ThieuandWesley Wigham 895f0a91de [jquery] Add examples documentation. (#29295) 2018-10-01 20:53:26 -07:00
Dainel YuleandJohn Reilly 5dc1165fb1 [jquery] Change return type of the index function to be Element instead of HTMLElement (#29212)
This reflects the fact that jQuery can be used to select other kinds of elements such as SVGElement
2018-09-26 21:22:11 +01:00
Andrew CaseyandGitHub 234b2170f0 Merge pull request #28888 from leonard-thieu/jquery/remove-const-enums
[jquery] Remove usages of `const enum`.
2018-09-24 11:25:44 -07:00
Leonard Thieu 7d71ffdae2 [jquery] Fix issue with resolving Symbol when used with ES5. 2018-09-18 06:26:45 -04:00
Nathan Shively-SandersandGitHub 11ce407429 Merge pull request #28769 from leonard-thieu/jquery/promise-compatibility
[jquery] Fix regression with assignability of jQuery Promises to Promise.
2018-09-17 15:13:03 -07:00
Terry Mun bf4b60d283 Updated tests to include prepending to document fragment 2018-09-15 11:51:22 +02:00
Terry Mun 8d250ffcd8 prependTo() and appendTo() should work with Element or DocumentFragment 2018-09-15 11:43:11 +02:00
Leonard Thieu 6912302128 [jquery] Fix region folding for VS Code. 2018-09-14 08:16:42 -04:00
Leonard Thieu 3aa7d5edd1 [jquery] Remove usages of const enum.
`Mouse` and `Key` were provided for convenience. Their presence is problematic though as they're not actually part of the jQuery API, cause the `JQuery` namespace to become a value, and doesn't work with the `isolatedModules` option.
2018-09-14 08:16:35 -04:00
Terry Mun 2faff4872d Added author credits 2018-09-11 13:38:05 +02:00
Terry Mun 9cd2d6f51a .appendTo() should accept a document fragment as an argument (not just Element) 2018-09-11 13:29:18 +02:00
Leonard Thieu 23dbcc7145 [jquery] Fix regression with assignability of jQuery Promises to Promise. 2018-09-10 19:07:34 -04:00
denisnameandAndy 24973f21e7 JQuery: HTMLSelectElement and arrays (#27810)
* Change to work better with arrays and HTMLSelectElement

See pull request description

* document.body and document.documentElement are possibly null in TypeScript@next

* Select2 fix test

* Change according to review comments

* Fix JQuery<any> in TS 2.3

* CI failed, force to run again

* document.body is not null anymore

* Rename params

* Add a comment above the `tslint:disable`s

* Wrong line :/

I went too fast
2018-08-15 08:48:04 -07:00
AndyandGitHub 73227df0fd Jquery: change disables in tslint.json to disables in specific files (#27919) 2018-08-07 12:11:07 -07:00
FUJI GoroandWesley Wigham 9fa7394da1 [@types/jquery] fix: let jQuery's insertAfter / insertBefore accept Node and JQuery<Node> (#27404)
* fix: let jQuery's insertAfter / insertBefore accept JQuery<HTMLElement> as well as HTMLElement

* jquery now requires typescript 2.4

* fix jQuery dts to compile on TypeScript 2.3
2018-07-20 17:56:39 -07:00
Leonard ThieuandJohn Reilly 63867fb112 [jquery] offset can accept a partial Coordinates object. (#27437) 2018-07-20 13:31:21 +01:00
segayuuandRyan Cavanaugh 1a07f27101 [@types/Bluebird] Make iterative methods rigid types without type parameters. (#27216)
* Resolve bluebird(Array) method

* upgrade typescript version from bluebird-global

* move testfile
Reason: There are too many type definition files
  depending on jquery and it can not be managed.

* upgrade typescript version from bluebird require packages

* fix lint error: use-default-type-parameter
2018-07-12 09:23:46 -07:00
Nathan Shively-SandersandGitHub 3c9c7fdacb Merge pull request #26674 from leonard-thieu/jquery/jquerystatic-type-parameter
[jquery] Remove type parameter from `JQueryStatic`
2018-06-19 12:46:05 -07:00
Leonard Thieu f3b10b2269 [jquery] Add tests to cover the changed APIs. 2018-06-19 13:56:49 -04:00
Leonard Thieu 9e427aa322 [jquery] Improve lint compliance. 2018-06-19 13:41:49 -04:00
Leonard Thieu 5af51abb91 [jquery] Remove type parameter from JQueryStatic.
The type parameter does not provide additional type safety. It also forced unnecessary type assertions in some usage scenarios.
2018-06-19 10:27:17 -04:00
Leonard Thieu 7591cf4318 Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped into jquery/deprecations
# Conflicts:
#	types/jquery/index.d.ts
2018-06-19 07:18:56 -04:00
Nathan Shively-SandersandGitHub 545210a449 Merge pull request #26452 from leonard-thieu/jquery/doc-links
[jquery] Fix documentation links for Visual Studio Code.
2018-06-18 14:28:22 -07:00
Nathan Shively-SandersandGitHub a4ac890e6e Merge pull request #26420 from leonard-thieu/jquery/bluebird-global
[jquery] Fix compatibility issue with `@types/bluebird-global`.
2018-06-18 14:14:22 -07:00
Holger JerominandGitHub 07b8c88db9 removing type parameter inline 2018-06-18 14:49:44 +02:00
Holger JerominandGitHub 0868c66683 fix build 2018-06-18 14:43:51 +02:00
Holger JerominandGitHub 2003aafc56 Adding more tests 2018-06-18 11:44:28 +02:00
Leonard ThieuandJohn Reilly bac2d1db56 [jquery] Fix return types for JQuery.map, JQueryStatic.map, and JQueryStatic(). (#26524)
* [jquery] Fix return type of `JQuery.map`.

The type parameter of the JQuery object returned from `JQuery.map` depends on the return values of the callback. Previously, the type parameter was based on the object it was called on.

This fix requires dropping constraints on `JQuery`, `JQueryStatic`, `EventHandler`, and `EventHandlerBase` as `JQuery.map` may return `JQuery` objects that contain non-`Node` values.

* [jquery] Fix return type of `JQueryStatic.map`.

* [jquery] Declare type for `this` in callback for `JQueryStatic.map`.

* [jquery] Fix return type for `JQueryStatic()`.

* [bootstrap] Match change to `JQuery` interface.

* [flight] Fix test failure due to change in `@types/jquery`.

* [materialize-css] Fix test failure due to change in `@types/jquery`.

* [select2] Match changes to `@types/jquery` interfaces.

* [jquery] Fix error due to breaking change in TypeScript lib declarations.

(cherry picked from commit 2506245)
2018-06-17 23:02:23 +01:00
Leonard Thieu 97786c2536 [jquery] Fix error due to breaking change in TypeScript lib declarations.
(cherry picked from commit 2506245)
2018-06-17 14:32:21 -04:00
Leonard Thieu 62aca55d9a [jquery] Fix error due to breaking change in TypeScript lib declarations.
(cherry picked from commit 2506245)
2018-06-17 14:31:51 -04:00
Leonard Thieu 2506245210 [jquery] Fix error due to breaking change in TypeScript lib declarations. 2018-06-16 14:55:01 -04:00
Leonard Thieu 6f3dda7450 [jquery] Fix documentation links for Visual Studio Code. 2018-06-11 14:05:02 -04:00
Leonard Thieu 29f3a61db1 [jquery] Add guidance for deprecated APIs. 2018-06-11 13:30:47 -04:00