All Projects → jhukdev → tsdom

jhukdev / tsdom

Licence: MIT license
Fast, lightweight TypeScript DOM manipulation utility

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tsdom

Hyperhtml
A Fast & Light Virtual DOM Alternative
Stars: ✭ 2,872 (+17850%)
Mutual labels:  lightweight, dom, manipulation
php-dom-wrapper
Simple DOM wrapper library to manipulate and traverse HTML documents similar to jQuery
Stars: ✭ 103 (+543.75%)
Mutual labels:  dom, manipulation
string-combinations
A simple, low-memory footprint function to generate all string combinations from a series of characters.
Stars: ✭ 25 (+56.25%)
Mutual labels:  lightweight, manipulation
Mei.js
a minimal, simple and helpful library for you
Stars: ✭ 15 (-6.25%)
Mutual labels:  dom, manipulation
Maquette
Pure and simple virtual DOM library
Stars: ✭ 729 (+4456.25%)
Mutual labels:  lightweight, dom
Viperhtml
Isomorphic hyperHTML
Stars: ✭ 318 (+1887.5%)
Mutual labels:  lightweight, manipulation
Rye
A modern, lightweight browser library using ES5 natives
Stars: ✭ 271 (+1593.75%)
Mutual labels:  dom, manipulation
Dom99
Extend html with directives
Stars: ✭ 37 (+131.25%)
Mutual labels:  lightweight, dom
CalDOM
An agnostic, reactive & minimalist (3kb) JavaScript UI library with direct access to native DOM.
Stars: ✭ 176 (+1000%)
Mutual labels:  lightweight, dom
front-end-interview-questions
No description or website provided.
Stars: ✭ 27 (+68.75%)
Mutual labels:  dom
FaceRecognitionCpp
Large input size REAL-TIME Face Detector on Cpp. It can also support face verification using MobileFaceNet+Arcface with real-time inference. 480P Over 30FPS on CPU
Stars: ✭ 40 (+150%)
Mutual labels:  lightweight
ProcessAdminActions
ProcessWire control panel for running various admin actions
Stars: ✭ 17 (+6.25%)
Mutual labels:  manipulation
minidenticons
Super lightweight SVG identicon (icon avatar) generator
Stars: ✭ 89 (+456.25%)
Mutual labels:  lightweight
js-symbol-tree
Turn any collection of objects into its own efficient tree or linked list using Symbol
Stars: ✭ 86 (+437.5%)
Mutual labels:  dom
logger
☠ 😈 👀 Simple,Secure & Undetected (6.11.2017) keylogger for Windows :)
Stars: ✭ 37 (+131.25%)
Mutual labels:  lightweight
kPAM
kPAM: Generalizable Robotic Manipulation
Stars: ✭ 73 (+356.25%)
Mutual labels:  manipulation
respo.cljs
A virtual DOM library built with ClojureScript, inspired by React and Reagent.
Stars: ✭ 232 (+1350%)
Mutual labels:  dom
wombag
Wombag is the alternative, lightweight backend for your Wallabag apps. Wombag supports the Wallabag API.
Stars: ✭ 42 (+162.5%)
Mutual labels:  lightweight
tinyrpc
Much fast, lightweight, async, based boost.beast and protobuf.
Stars: ✭ 32 (+100%)
Mutual labels:  lightweight
PopUpOFF
Chrome extension, providing better web experience.
Stars: ✭ 65 (+306.25%)
Mutual labels:  dom

tsdom

Fast, lightweight DOM manipulation utility with TypeScript definitions. 1.8kb gzipped.

Install

npm install --save tsdom

Setup

Add the package to your project using one of the following:

  • let tsdom = require('tsdom')
  • import tsdom from 'tsdom'
  • <script src="./tsdom.inc.js" /> ("tsdom/dist/tsdom.inc.js")

Usage

TSDom uses CSS (or jQuery) selector syntax, e,g:

  • let el = tsdom(element)
  • let el = tsdom("div")
  • let el = tsdom("#yourId")
  • let el = tsdom(".yourClass")
  • let el = tsdom("[data-attribute]")

API

Once you've selected an element or elements, you can chain the following methods:

  • el.first()
  • el.find("#yourSelector")
  • el.closest(".yourSelector")
  • el.each(e => { // do something })
  • el.append("<p>Lorem ipsum</p>" | Node | HTMLElement)
  • el.prepend("<p>Lorem ipsum</p>" | Node | HTMLElement)
  • el.empty()
  • el.addClass("yourClass")
  • el.removeClass("yourClass")
  • el.toggleClass("yourClass")
  • el.css({ opacity: "0" })
  • el.attr({ title: "Your new title" })
  • el.on("click", (ev: Event, el: HTMLElement) => { // do something })
  • el.on("click", ".yourClass", (ev: Event, el: HTMLElement) => { // do something })
  • el.off("click")

The following are return methods

  • el.get(0)
  • el.hasClass("active")
  • el.val()
  • el.val("value")
  • el.text()
  • el.text("Lorem ipsum")
  • el.data("key")
  • el.data("key", "value")
  • el.attr("key")
  • el.html()
  • el.html("<div>Lorem ipsum</div>")
  • el.toArray()

And these are NON return methods

  • el.remove()

Types

The package exports the following type namespace for use in your app:

  • import tsdom, { TSDom } from 'tsdom'
    • TSDom.Init == tsdom
    • TSDom.Object == tsdom("#yourSelector")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].