New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

smpldm

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smpldm

Simplifying the DOM

latest
Source
npmnpm
Version
1.1.5
Version published
Maintainers
1
Created
Source

Simple DOM

Installation:

npm i --save smpldm
yarn add smpldm

Basic usage:

const {add, SmpldmElement, byID} = require("smpldm");

const input = new SmpldmElement("input", { className: "red" });
input.on("click focus", () => document.body.style.backgroundColor = "red");
input.on("blur", () => document.body.style.background = "white");

add(input).to(byID("container"));

Basic Documentation:

Creating elements
//                New Element     TagName       Attributes (note class becomes className)
const myElement = new SmpldmElement("p", { className: "body", id: "main-text" }, [data.mainText])
//                                                                               Array of Children (including plain text)
//                                                                               smpldm automagically makes text nodes
Adding event listeners (a custom Smpldm Feature)

Note, this only works on elements created with Smpldm, not regular HTML elements

// This is effectively a shorthand for .addEventListener, hence the ...options

myElement.on("click focus")
// OR 
myElement.on(["click", "focus"], callback, ...options)
Appending one element to another
add(myElement).to(parent); // Where parent and myElement can be either SmpldmElements OR regular HTMLElement's

GLHF!

FAQs

Package last updated on 28 Dec 2019

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