{"id":15416539,"url":"https://github.com/jahilldev/tsdom","last_synced_at":"2025-07-06T00:09:10.089Z","repository":{"id":57381500,"uuid":"96093758","full_name":"jahilldev/tsdom","owner":"jahilldev","description":"Fast, lightweight TypeScript DOM manipulation utility","archived":false,"fork":false,"pushed_at":"2022-03-21T12:58:21.000Z","size":382,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-21T16:20:58.723Z","etag":null,"topics":["dom","javascript","library","lightweight","manipulation","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jahilldev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-03T09:24:05.000Z","updated_at":"2023-10-09T15:55:51.000Z","dependencies_parsed_at":"2022-09-01T01:11:02.058Z","dependency_job_id":null,"html_url":"https://github.com/jahilldev/tsdom","commit_stats":null,"previous_names":["jhdevuk/tsdom"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jahilldev/tsdom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Ftsdom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Ftsdom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Ftsdom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Ftsdom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jahilldev","download_url":"https://codeload.github.com/jahilldev/tsdom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Ftsdom/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263828726,"owners_count":23516791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom","javascript","library","lightweight","manipulation","typescript"],"created_at":"2024-10-01T17:12:19.153Z","updated_at":"2025-07-06T00:09:10.044Z","avatar_url":"https://github.com/jahilldev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tsdom\nFast, lightweight DOM manipulation utility with TypeScript definitions.\n**1.8kb** gzipped.\n### Install\n`npm install --save tsdom`\n### Setup\nAdd the package to your project using one of the following:\n- `let tsdom = require('tsdom')`\n- `import tsdom from 'tsdom'`\n- `\u003cscript src=\"./tsdom.inc.js\" /\u003e` (\"tsdom/dist/tsdom.inc.js\")\n### Usage\nTSDom uses CSS (or jQuery) selector syntax, e,g:\n- `let el = tsdom(element)`\n- `let el = tsdom(\"div\")`\n- `let el = tsdom(\"#yourId\")`\n- `let el = tsdom(\".yourClass\")`\n- `let el = tsdom(\"[data-attribute]\")`\n### API\nOnce you've selected an element or elements, you can chain the following methods:\n- `el.first()`\n- `el.find(\"#yourSelector\")`\n- `el.closest(\".yourSelector\")`\n- `el.each(e =\u003e { // do something })`\n- `el.append(\"\u003cp\u003eLorem ipsum\u003c/p\u003e\" | Node | HTMLElement)`\n- `el.prepend(\"\u003cp\u003eLorem ipsum\u003c/p\u003e\" | Node | HTMLElement)`\n- `el.empty()`\n- `el.addClass(\"yourClass\")`\n- `el.removeClass(\"yourClass\")`\n- `el.toggleClass(\"yourClass\")`\n- `el.css({ opacity: \"0\" })`\n- `el.attr({ title: \"Your new title\" })`\n- `el.on(\"click\", (ev: Event, el: HTMLElement) =\u003e { // do something })`\n- `el.on(\"click\", \".yourClass\", (ev: Event, el: HTMLElement) =\u003e { // do something })`\n- `el.off(\"click\")`\n\nThe following are return methods\n- `el.get(0)`\n- `el.hasClass(\"active\")`\n- `el.val()`\n- `el.val(\"value\")`\n- `el.text()`\n- `el.text(\"Lorem ipsum\")`\n- `el.data(\"key\")`\n- `el.data(\"key\", \"value\")`\n- `el.attr(\"key\")`\n- `el.html()`\n- `el.html(\"\u003cdiv\u003eLorem ipsum\u003c/div\u003e\")`\n- `el.toArray()`\n\nAnd these are NON return methods\n- `el.remove()`\n### Types\nThe package exports the following type namespace for use in your app:\n- `import tsdom, { TSDom } from 'tsdom'`\n  - `TSDom.Init` == `tsdom`\n  - `TSDom.Object` == `tsdom(\"#yourSelector\")`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahilldev%2Ftsdom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjahilldev%2Ftsdom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahilldev%2Ftsdom/lists"}