1.0.20 • Published 3 years ago

@etchedjs/dom v1.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@etchedjs/dom

npm.io

A utility to write some DOM elements, based on @etchedjs/etched.

Install

npm i @etchedjs/dom

Implementations

Exports

Models

dom

A base model etched by the following models

node

A base model etched by the following node-related models

children

A model that wrap the element children, it etches dom

The children must be named and can be filled by

  • Elements
  • Strings (resolved as TextNode)
  • Arrays of elements and/or strings (useful to permit any number of contents)

attribute

A model that represent an element attribute, it etches dom.node

dataset

A model that wrap the element dataset, it etches dom.node

element

A model that represent an element, it etches dom.node

Methods

declare

declare(element, { children = null, dataset = null, ...attributes } = {})

Returns an etched model of the provided element, etched with the provided properties.

It can be used, to create some spec/custom elements.

fill

fill(element, { children = null, dataset = null, ...attributes } = {})

Returns the provided element, etched with the provided properties.

Basically, it fills an element with the provided data.

fragment

fragment(document, ...nodes)

Returns a DocumentFragment containing the provided nodes as DOM nodes

Need a server-side document? Just import it from @etchedjs/dom/document.js

serialize

serialize(fragment)

Returns a string containing fragment source

Licence

MIT

1.0.19

3 years ago

1.0.20

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago