1.0.20 • Published 4 years ago

@etchedjs/dom v1.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
4 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

4 years ago

1.0.20

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago