Skip to content

KooiInc/tinyDOM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyDOM

Create HTML elements using the element/tag name as a function

This small library offers a way to dynamically create HTML elements using tag names as functions.

Details

  • The library uses a Proxy, so the element functions are lazy loaded (on demand).
  • Tag function names are case insensitive
    (e.g. tags.DIV or tags.div, const {h3, H3, DIV, p, P} = tags)

The first parameter of a tag function may be an Object literal, containing textContent / innerHTML /
reflected element properties / (data-)attributes.

  • address the className property as {class: 'class1 class2 ...'}
  • address attributes as {attributes: {attr1: '...', ...}
  • address data-attributes as {data: {one: '...', ...}}
  • address innerHTML/textContent as {html: ...} or {text: ...}

Check the demonstration page to learn more.

Enjoy!


For a more comprehensive DOM helper, check my JQuery alike module (JQx).

About

A small html element creation helper library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors