项目作者: cspoels

项目描述 :
Tiny and quick way to create DOM elements
高级语言: JavaScript
项目地址: git://github.com/cspoels/Element.git
创建时间: 2019-04-24T11:13:40Z
项目社区:https://github.com/cspoels/Element

开源协议:MIT License

下载


@cspoels:element

Install

  1. yarn add @cspoels/Element

Use

To start, load the script

  1. const Element = require('@cspoels/element')

To create a new element in the body of the document

  1. let element = new Element(document.body).create()

An element will be created, it will remember the root for appending alter. The root parameter can be

  • A string: To search by id
  • A DOM element to appen dto
  • Another Element instance
  • [Default] null, will transform to document.body

you can alter the element with functions as:

  1. element.class('is-primary').id('super-element').text('I am the best element')