Skip to content

Commit

Permalink
Merge pull request #17 from ernestmarcinko/typings
Browse files Browse the repository at this point in the history
Element to HTMLElement
  • Loading branch information
ernestmarcinko authored Jul 11, 2024
2 parents 90dbba5 + d363d18 commit a8025b8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion dist/domini-core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/domini.js

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions domini.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
declare module "domini" {
type ElementWithFields = Element&{[otherFields: string]: unknown;};
type HTMLElementWithFields = HTMLElement&{[otherFields: string]: unknown;};

interface DOMini extends Array<ElementWithFields> {
(selector?: string|Element): this;
interface DOMini extends Array<HTMLElementWithFields> {
(selector?: string|HTMLElement): this;
fn: {
_: (selector: string) => Array<ElementWithFields>,
_: (selector: string) => Array<HTMLElementWithFields>,

ajax: (args: {
'url': string,
Expand Down Expand Up @@ -38,22 +38,22 @@ declare module "domini" {

bodyTransformX: () => number,

hasFixedParent: (element: Element) => boolean,
hasFixedParent: (element: HTMLElement) => boolean,

hasEventListener: (element: Element, event_type: string, func: Function) => boolean,
hasEventListener: (element: HTMLElement, event_type: string, func: Function) => boolean,

allDescendants: (element: Element) => Array<Element>,
allDescendants: (element: HTMLElement) => Array<HTMLElement>,

createElementsFromHTML: (html_string: string) => Array<Element>,
createElementsFromHTML: (html_string: string) => Array<HTMLElement>,

elementArrayFromAny: (anything: string|Element|Element[]|DOMini) => Array<Element>,
elementArrayFromAny: (anything: string|HTMLElement|HTMLElement[]|DOMini) => Array<HTMLElement>,

absolutePosition: (element: Element) => {
absolutePosition: (element: HTMLElement) => {
top: number,
left: number,
},
}
add: (selector: string|Element) => this,
add: (selector: string|HTMLElement) => this,

css: {
(properties: Record<string, unknown>): this;
Expand Down Expand Up @@ -106,11 +106,11 @@ declare module "domini" {

extend: (...args: Object) => Object,

each: (callback: (index?: number, node?: ElementWithFields, array?: ElementWithFields[])=>unknown) => this
each: (callback: (index?: number, node?: HTMLElementWithFields, array?: HTMLElementWithFields[])=>unknown) => this

forEach: (callback: (node?: ElementWithFields, index?: number, array?: ElementWithFields[])=>unknown) => this
forEach: (callback: (node?: HTMLElementWithFields, index?: number, array?: HTMLElementWithFields[])=>unknown) => this

get: (n: number) => ElementWithFields,
get: (n: number) => HTMLElementWithFields,

offset: ()=> {
top: number,
Expand Down Expand Up @@ -163,13 +163,13 @@ declare module "domini" {

clone: () => this,

detach: (context?: string|Element) => this,
detach: (context?: string|HTMLElement) => this,

remove: (context?: string|Element) => this,
remove: (context?: string|HTMLElement) => this,

prepend: (prepend: string|Element|Element[]|DOMini) => this,
prepend: (prepend: string|HTMLElement|HTMLElement[]|DOMini) => this,

append: (prepend: string|Element|Element[]|DOMini) => this,
append: (prepend: string|HTMLElement|HTMLElement[]|DOMini) => this,

is: (selectors: string) => boolean,

Expand All @@ -185,7 +185,7 @@ declare module "domini" {

next: (selectors?: string) => this,

closest: (selectors?: string|Element|DOMini) => this,
closest: (selectors?: string|HTMLElement|DOMini) => this,

find: (selectors?: string) => this,

Expand Down Expand Up @@ -220,7 +220,7 @@ declare module "domini" {

serializeObject: (object: Object<unknown>, prefix: string) => string,

inViewPort: (tolerance: number = 0, viewport: Element = window) => boolean,
inViewPort: (tolerance: number = 0, viewport: HTMLElement = window) => boolean,

/**
* Addons and other possibly dynamically added fields
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "domini",
"version": "0.2.5",
"version": "0.2.6",
"description": "Minimalistic DOM manipulation tool",
"main": "dist/domini.js",
"types": "domini.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if ( typeof window.DoMini == 'undefined' ) {
// Utility functions container
DoMini._fn = {};

DoMini.version = "0.2.5";
DoMini.version = "0.2.6";
} else {
DoMini = window.DoMini;
}
Expand Down

0 comments on commit a8025b8

Please sign in to comment.