Socket
Socket
Sign inDemoInstall

crelt

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crelt

Tiny DOM-element-creation utility


Version published
Weekly downloads
2.1M
increased by3.18%
Maintainers
1
Weekly downloads
 
Created

What is crelt?

The 'crelt' npm package is a utility for creating DOM elements using a concise and readable syntax. It simplifies the process of generating HTML elements programmatically, making it easier to build and manipulate the DOM in JavaScript.

What are crelt's main functionalities?

Create a single DOM element

This feature allows you to create a single DOM element with specified attributes and content. In this example, a 'div' element with the class 'container' and the text 'Hello, World!' is created and appended to the document body.

const crel = require('crelt');
const div = crel('div', { class: 'container' }, 'Hello, World!');
document.body.appendChild(div);

Create nested DOM elements

This feature allows you to create nested DOM elements in a single call. In this example, a 'div' element with two nested 'span' elements is created and appended to the document body.

const crel = require('crelt');
const nestedElements = crel('div', { class: 'parent' },
  crel('span', { class: 'child' }, 'Child 1'),
  crel('span', { class: 'child' }, 'Child 2')
);
document.body.appendChild(nestedElements);

Create elements with event listeners

This feature allows you to create DOM elements with event listeners attached. In this example, a 'button' element with an 'onclick' event listener that shows an alert when clicked is created and appended to the document body.

const crel = require('crelt');
const button = crel('button', { onclick: () => alert('Button clicked!') }, 'Click Me');
document.body.appendChild(button);

Other packages similar to crelt

Keywords

FAQs

Package last updated on 17 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc