DefinitelyTyped/types/nwmatcher/index.d.ts
Nathan Shively-Sanders f0ce987bc1 Update project urls to match NPM url
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.
2019-02-11 17:10:55 -08:00

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;