mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Note that this *trivially* updates project urls by adding the NPM url to the end, even when the urls are almost identical or the DT one is outdated. I'll clean up the urls in a later commit. This PR is unfinished! Please do not merge it yet.
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
// Type definitions for nwmatcher 1.4
|
|
// Project: https://github.com/dperini/nwmatcher, http://javascript.nwbox.com/nwmatcher
|
|
// Definitions by: Wouter van Heeswijk <https://github.com/woutervh->
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
declare function nwmatcher(global: { document: Document }): nwmatcher.Matcher;
|
|
|
|
declare namespace nwmatcher {
|
|
interface Matcher {
|
|
// DOM Selection
|
|
|
|
first: (selector: string, context?: Element) => Element | null;
|
|
match: (element: Element, selector: string, context?: Element) => boolean;
|
|
select: (selector: string, context?: Element, callback?: (element: Element) => void) => Element[];
|
|
|
|
// DOM Helpers
|
|
|
|
byId: (id: string, from?: Element) => Element | null;
|
|
byTag: (tag: string, from?: Element) => Element[];
|
|
byClass: (className: string, from?: Element) => Element[];
|
|
byName: (name: string, from?: Element) => Element[];
|
|
getAttribute: (element: Element, attribute: string) => string | undefined;
|
|
hasAttribute: (element: Element, attribute: string) => boolean;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
namespace NW {
|
|
const Dom: nwmatcher.Matcher;
|
|
}
|
|
}
|
|
|
|
export = nwmatcher;
|