mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* [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)
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
|
|
declare var el: Element;
|
|
declare var els: HTMLElement[];
|
|
declare var mixinFn: Function;
|
|
|
|
function TestComponent() {
|
|
var self: Flight.Component = this;
|
|
|
|
self.attributes({
|
|
fooSelector: '.bar'
|
|
});
|
|
|
|
self.defaultAttrs({
|
|
fooSelector: '.bar'
|
|
});
|
|
|
|
this.onClick = function (ev: JQueryEventObject, data: Flight.EventData) {
|
|
var el: HTMLElement = data.el;
|
|
self.select('fooSelector').addClass('bar');
|
|
};
|
|
|
|
self.around('initialize', function () { });
|
|
self.before('initialize', function () { });
|
|
self.after("initialize", function () {
|
|
|
|
var $node: JQuery = self.$node;
|
|
var node: Element = self.node;
|
|
|
|
self.on(el, 'click', {});
|
|
self.on(els, 'click', function () { });
|
|
self.on(document, 'click', this.onClick);
|
|
self.on('click', function () { });
|
|
self.on('click', {
|
|
fooSelector: this.onClick
|
|
});
|
|
|
|
self.off('click', function () { });
|
|
self.off(document, 'click');
|
|
self.off(el, 'click')
|
|
self.off(els, 'click');
|
|
|
|
self.teardown();
|
|
});
|
|
}
|
|
|
|
flight.component(TestComponent, mixinFn).attachTo(el);
|
|
flight.component(TestComponent, mixinFn).attachTo($(els));
|
|
flight.component(TestComponent, mixinFn).attachTo('.test');
|
|
flight.component(TestComponent, mixinFn).attachTo('.test', {
|
|
some: 'data'
|
|
});
|
|
|
|
flight.component.teardownAll();
|