Commit Graph

230 Commits

Author SHA1 Message Date
Chives
694bcf0030 Add definitions for CustomEvent in jQuery 2019-01-07 17:41:38 -08:00
Oscar Busk
e8e08f3ed1
Deprecate which property in jquery/v1 as well 2018-12-19 22:19:30 +01:00
Oscar Busk
b25f5a08f5
Deprecate char, charCode, keyCOde in jquery/v1 as well 2018-12-19 22:13:13 +01:00
Oscar Busk
c04b95b485
Add type to charand key in jquery/v1 2018-12-19 22:11:00 +01:00
Oscar Busk
9994b088c4
Deprecate char, charCode and keyCode in jquery/legacy.d.ts.
While the object itself is deprectade, it can be good to deprecate the properties aswell.
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/31303#discussion_r243018492
2018-12-19 22:09:54 +01:00
Oscar Busk
e84be5f370
Merge branch 'master' of github.com:oBusk/DefinitelyTyped into fix-jquery-2-events 2018-12-19 21:59:38 +01:00
Oscar Busk
4f7d2f91d4
Replace angle-bracket-type-assertions with "as" assertion 2018-12-19 01:20:29 +01:00
Nathan Shively-Sanders
ef06579ce9
Merge pull request #30234 from leonard-thieu/jquery/text-comment-parameters
[jquery] Allow Text/Comment nodes for some APIs that accept an HTML string.
2018-12-18 13:12:20 -08:00
oBusk
823068c14c Fix types in legacy.d.ts 2018-12-18 13:45:44 +01:00
oBusk
6472ffd15d Revert "Bump to cause CI"
This reverts commit 4b863f9a00.
2018-12-18 13:30:13 +01:00
oBusk
4b863f9a00 Bump to cause CI 2018-12-18 13:29:51 +01:00
Jesse Trinity
4e5ac82d0f
Merge pull request #31272 from leonard-thieu/jquery/call-signature-arrayLike
[jquery] Fix ArrayLike handling for call signature.
2018-12-13 13:20:08 -08:00
Jesse Trinity
ac31768b7b
Merge pull request #31164 from leonard-thieu/jquery/off
[jquery] Fix issue with unbinding event handlers for specific event types.
2018-12-13 11:20:13 -08:00
oBusk
cc4eacc437 Add @deprecated to which 2018-12-12 13:10:41 +01:00
oBusk
d5cabe21c0 Marking char, charCode and keyCode as deprecated. 2018-12-12 12:30:23 +01:00
oBusk
f261339bb6 Add type to char and key 2018-12-12 12:26:25 +01:00
oBusk
db52ccd657 Fix tests using <> syntax 2018-12-12 12:23:15 +01:00
UrielCh
cca60bd544 Add Document as JQuery.contents() output encapsulated type. (#31296)
$('iframe').contents() is a JQuery<Document>;
2018-12-12 08:46:22 +00:00
Leonard Thieu
1caac6ef59 [jquery] Fix ArrayLike handling for call signature. 2018-12-11 12:26:21 -05:00
Leonard Thieu
5001e2c42f [jquery] Fix declaration of function parameter for .replaceWith(). 2018-12-09 14:51:34 -05:00
Leonard Thieu
5c9f9cc6ae [jquery] Allow Text/Comment nodes.
See https://github.com/jquery/api.jquery.com/issues/879#issuecomment-175774521.
2018-12-09 14:51:34 -05:00
Leonard Thieu
cf2baee61a [jquery] Add originalEvent property to TriggeredEvent. (#31189) 2018-12-09 08:53:44 +00:00
Leonard Thieu
fa27dfe857 [jquery] Fix issue with unbinding event handlers for specific event types. 2018-12-07 13:23:48 -05:00
Leonard Thieu
bf2beee34c [jquery] Fix no-angle-bracket-type-assertion violations. 2018-11-24 09:45:54 -05:00
Leonard Thieu
e573d98516 [jquery] Add tests for JQuery.TypeEventHandlers. 2018-11-24 09:43:08 -05:00
Leonard Thieu
33c6e58f6e [jquery] Add missing TTarget type parameter to touch events. 2018-11-24 09:43:08 -05:00
Leonard Thieu
db83bc7200 [jquery] Don't use a separate type parameter for the type of this in event handlers.
A separate type parameter is unnecessary as `this` and `currentTarget` reference the same object.
2018-11-24 09:43:08 -05:00
Leonard Thieu
3a54bad068 [jquery] Add support for touch events.
Fixes test failures in `viewporter` due to changes in jQuery Events API.
2018-11-24 09:43:07 -05:00
Leonard Thieu
00c546398c [jquery] Add support for event types that have shorthand methods. 2018-11-24 09:43:04 -05:00
Leonard Thieu
f13af8beb0 [jquery] Improve declaration of Events API.
* Introduced the concept of a triggered event. A triggered event is a jQuery event that has been triggered (either manually by `.trigger()` or `.triggerHandler()`, or automatically by the user agent). Many properties on an event are not set until it has been triggered. Triggered events are now represented by `JQuery.TriggeredEvent`. `JQuery.Event` represents the object returned from the `jQuery.Event` constructor and serves as the base type for all jQuery events.

* Added a type parameter for `currentTarget` (`TCurrentTarget`). Previously, `currentTarget` was set to the type of `delegateTarget`. This was only correct for events received from directly bound event handlers. This allows delegate bound event handlers to specify the correct type of `currentTarget`.

* Added a type parameter for `target` (`TTarget`). Previously, `target` was set to the type of `delegateTarget`. This was not always correct. For delegate bound event handlers, `target` can be `delegateTarget` or any of its descendents. The exact type of `target` cannot be known until run time, so consumers should use a type assertion.

* Changed methods that bind event handlers to more accurately reflect the event object received through the callback. Both direct and delegate binding are now properly handled. This also includes a framework for providing more specific events for known event types.
2018-11-24 09:43:03 -05:00
Leonard Thieu
c1ec1c28e5 [jquery] Remove JQuery.EventHandlerBase<TContext = any, JQuery.Event> from handler types.
Handler types previously included `JQuery.EventHandlerBase<TContext = any, JQuery.Event>`. This was a fix to what turned out to be a problem with `jQuery.proxy`. That issue was properly fixed by https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29930.
2018-11-24 09:43:03 -05:00
Leonard Thieu
32e0482fb5 [jquery] Remove jQuery.Event(EventLike) signatures and EventLike interface.
These are undocumented and don't appear to be intended to be public.
2018-11-24 09:43:02 -05:00
Leonard Thieu
50b56a19ce [jquery] Remove jQuery.event.props.
See https://jquery.com/upgrade-guide/3.0/#breaking-change-jquery-event-props-and-jquery-event-fixhooks-removed.
2018-11-24 09:43:02 -05:00
Leonard Thieu
e64bea6d88 [jquery] Remove jQuery.event.fixHooks.
See https://jquery.com/upgrade-guide/3.0/#breaking-change-jquery-event-props-and-jquery-event-fixhooks-removed.
2018-11-24 09:43:01 -05:00
Leonard Thieu
16770fa6e1 [jquery] Add deprecation notice for Event.which. 2018-11-24 09:43:01 -05:00
Andy
141d1cc870
And tslint disables for no-angle-bracket-type-assertion (#30592) 2018-11-16 12:20:58 -08:00
Andy
307a9a0181
jquery: Add no-unnecessary-type-assertion disables (#30319) 2018-11-06 11:26:42 -08:00
Leonard Thieu
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 Thieu
59b32e5353 [jquery] Add self-extending overloads of jQuery.extend(). (#29924) 2018-10-22 09:25:28 -07:00
Leonard Thieu
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 Thieu
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 Thieu
c3cbb348e2 [jquery] Add includeMargin parameter to .outerHeight() and .outerWidth() setters. (#29756)
* [jquery] Add `includeMargin` parameter to `.outerHeight()` and `.outerWidth()` setters.

See 354f6036f2/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 Thieu
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 Thieu
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 Thieu
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 Thieu
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 Thieu
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 354f6036f2/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 Thieu
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 Thieu
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
boriskor
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