mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #17448 from leonard-thieu/jquery
[jquery] Update type definitions
This commit is contained in:
+16
-1
@@ -9,7 +9,7 @@ When jQuery is globally available, you can use `jQuery` and `$` directly.
|
||||
When you want to import jQuery as a module and have a global DOM available (e.g. browser and browser-like environments):
|
||||
|
||||
```typescript
|
||||
import * as jQuery from 'jquery';
|
||||
import jQuery = require('jquery');
|
||||
```
|
||||
|
||||
#### Importing (without a global DOM available)
|
||||
@@ -23,6 +23,21 @@ const jQuery = jQueryFactory(window, true);
|
||||
|
||||
Note that while the factory function ignores the second parameter, it is required to get correct type declarations.
|
||||
|
||||
### Project structure
|
||||
|
||||
- [jquery-tests.ts](jquery-tests.ts)
|
||||
- Tests that exercise TypeScript-specific usage and cases not covered by other test files.
|
||||
- [test/example-tests.ts](test/example-tests.ts)
|
||||
- Tests generated from examples in jQuery documentation.
|
||||
- [test/longdesc-tests.ts](test/longdesc-tests.ts)
|
||||
- Tests generated from non-example snippets in jQuery documentation.
|
||||
- [test/jquery-window-module-tests.ts](test/jquery-window-module-tests.ts)<br>
|
||||
[test/jquery-slim-window-module-tests.ts](test/jquery-slim-window-module-tests.ts)
|
||||
- Tests importing jQuery with a DOM available
|
||||
- [test/jquery-no-window-module-tests.ts](test/jquery-no-window-module-tests.ts)<br>
|
||||
[test/jquery-slim-no-window-module-tests.ts](test/jquery-slim-no-window-module-tests.ts)
|
||||
- Tests importing jQuery without a DOM available
|
||||
|
||||
### Authoring type definitions for jQuery plugins
|
||||
|
||||
`$.fn` is represented by `JQuery`.
|
||||
|
||||
Vendored
+469
-320
File diff suppressed because it is too large
Load Diff
+2049
-40
File diff suppressed because it is too large
Load Diff
@@ -2434,7 +2434,7 @@ function examples() {
|
||||
}
|
||||
|
||||
function jQuery_error_0() {
|
||||
jQuery.error = console.error as any;
|
||||
jQuery.error = console.error;
|
||||
}
|
||||
|
||||
function jQuery_escape_selector_0() {
|
||||
@@ -2907,7 +2907,7 @@ function examples() {
|
||||
function jQuery_parse_html_0() {
|
||||
var $log = $('#log'),
|
||||
str = 'hello, <b>my name is</b> jQuery.',
|
||||
html = $.parseHTML(str) as HTMLElement[],
|
||||
html = $.parseHTML(str),
|
||||
nodeNames: string[] = [];
|
||||
|
||||
// Append the parsed HTML
|
||||
@@ -4056,7 +4056,7 @@ function examples() {
|
||||
function promise_0() {
|
||||
var div = $('<div>');
|
||||
|
||||
div.promise().done(function(this: JQuery, arg1: JQuery) {
|
||||
div.promise().done(function(this: typeof div, arg1) {
|
||||
// Will fire right away and alert "true"
|
||||
alert(this === div && arg1 === div);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user