0.2.2 • Published 5 years ago

flxels v0.2.2

Weekly downloads
3
License
GPL-3.0-or-later
Repository
github
Last release
5 years ago

flxels

Create HTML elements in JavaScript. TypeScript type definitions included.

API

Create element specified by tag.

function el (tag: string): HTMLElement

Create styled element specified by tag and styles object.

type StylesObject = { [key: string]: string | StylesObject }
function styled (tag: string, styles: StylesObject): HTMLElement

Create styled or unstyled h1 element.

Styles object is optional.

function h1 (styles?: StylesObject): HTMLDivElement

div span h1 h2 p input button

Add class to specified element.

function add_class (element: HTMLElement, className: string): void

Remove class from specified element.

function remove_class (element: HTMLElement, className: string): void

Style specified element.

Adds a new css class on each call.

function style (element: HTMLElement, styles: StylesObject): void

Restyle specified element.

Assigns new css class.

function restyle (element: HTMLElement, styles: StylesObject): void

Add text node to specified element.

function add_text (element: HTMLElement, text: string): void

Remove text node from specified element.

If string passed instead of text node, removes string from textContent.

If no text arg passed, removes all text nodes.

function remove_text (element: HTMLElement, textNode?: Text): void
0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago