1.0.32 • Published 11 months ago

@brandup/ui-dom v1.0.32

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
11 months ago

brandup-ui-dom

Build Status

Installation

Install NPM package @brandup/ui-dom.

npm i @brandup/ui-dom@latest

DOM helper

Методы для простой работы с DOM моделью.

class DOM {
    static getElementById(id: string): HTMLElement | null;
    static getElementByClass(parentElement: Element, className: string): HTMLElement | null;
    static getElementByName(name: string): HTMLElement | null;
    static getElementByTagName(parentElement: Element, tagName: string): HTMLElement | null;
    static getElementsByTagName(parentElement: Element, tagName: string);
    static queryElement(parentElement: Element, query: string): HTMLElement | null;
    static queryElements(parentElement: Element, query: string): NodeListOf<HTMLElement>;
    static nextElementByClass(currentElement: Element, className: string): HTMLElement | null;
    static prevElementByClass(currentElement: Element, className: string): HTMLElement | null;
    static prevElement(currentElement: Element): HTMLElement | null;
    static nextElement(currentElement: Element): HTMLElement | null;

    static tag(tagName: string, options?: ElementOptions | string, children?: ((elem: Element) => void) | Element | string | Array<Element | string | ((parent: Element) => Element)>): HTMLElement

    static addClass(container: Element, selectors: string, className: string)
    static removeClass(container: Element, selectors: string, className: string);

    static empty(element: Element);
}

Creation HTML elements

DOM.tag("div", "css class name")
DOM.tag("div", "css class name", "<p>test</p>")
DOM.tag("div", "css class name", DOM.tag("p", null, "test"))
DOM.tag("div", {
    id?: string,
    dataset?: ElementData;
    styles?: ElementStyles;
    class?: string | Array<string>;
    events?: { [name: string]: EventListenerOrEventListenerObject };
    command?: string;
    [name: string]: string | number | boolean | object;
})
1.0.32

11 months ago

1.0.31

12 months ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.26

1 year ago

1.0.27

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago