{"id":16533557,"url":"https://github.com/af/littledom","last_synced_at":"2025-06-16T08:06:01.264Z","repository":{"id":6271664,"uuid":"7505166","full_name":"af/littledom","owner":"af","description":"[experimental] jQuery DOM subset, in less than 2kb","archived":false,"fork":false,"pushed_at":"2014-01-31T06:17:07.000Z","size":324,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-18T07:05:09.419Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/af.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-08T16:42:01.000Z","updated_at":"2016-01-03T05:49:08.000Z","dependencies_parsed_at":"2022-08-29T19:32:05.848Z","dependency_job_id":null,"html_url":"https://github.com/af/littledom","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/af/littledom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/af%2Flittledom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/af%2Flittledom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/af%2Flittledom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/af%2Flittledom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/af","download_url":"https://codeload.github.com/af/littledom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/af%2Flittledom/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260124032,"owners_count":22962199,"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":[],"created_at":"2024-10-11T18:15:13.124Z","updated_at":"2025-06-16T08:06:01.244Z","avatar_url":"https://github.com/af.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://secure.travis-ci.org/af/littledom.png)](http://travis-ci.org/af/littledom)\n\nlittledom\n=========\n\nlittledom is a really tiny (experimental) jQuery work-alike for modern browsers. Think of it\nas a curated jQuery subset, optimized for readability and file size.\n\nlittledom is *not* a drop-in replacement for jQuery, but it does implement many of its\nmost commonly used methods. In many cases, not all method signatures are supported either.\nThis keeps the code lean and pretty simple to read. The following parts of jQuery\nare intentionally omitted- if you need them you might consider a best-of-breed\nstandalone library instead:\n\n    * ajax() and friends\n    * promises\n    * any polyfills (a standards-compliant browser is assumed)\n    * utilities intended for objects and arrays ($.each, $.map, etc)\n    * anything else that falls outside out DOM querying and manipulation\n\nCheck out [the source code](https://github.com/af/littledom/blob/master/littledom.js),\nit's concise and should be easy to read and understand.\n\n\nStick with jQuery if:\n---------------------\n* You need to support IE8 or below\n* You need to use jQuery plugins\n* You want a really well-tested library (this one is still experimental)\n\n\nBrowser API dependencies:\n-------------------------\n* document.querySelectorAll() (used for all DOM searches)\n* addEventListener() and removeEventListener()\n* DOMContentLoaded\n* ECMAScript 5 Array methods (map, filter, forEach, etc)\n\n\nAPI\n---\n\n## Basic API format\n\n    $dom(selectorString, contextElement).\u003cmethod\u003e(\u003cargs\u003e);\n\n## Non-jQuery methods and attributes:\n\n    $dom.ready(callback)    -\u003e equivalent to $(document).ready(callback)\n    $dom.browserSupported   -\u003e boolean indicating whether the browser is supported by the library.\n    $dom.create(htmlString) -\u003e create a set of elements from an html string (like $(htmlString))\n\n## Supported jQuery API subset:\n\n```\n    // Manipulation:\n    html()                  -\u003e return the innerHTML of the first matched element\n    html(contents)          -\u003e sets innerHTML for all matched elements to the given string\n    find(selector)\n    remove()                -\u003e remove all matched elements from the document (doesn't take any arguments)\n    data(attrName)          -\u003e return the value of the given data-* attribute (for the first matched element where it's set)\n    data(attrName, val)     -\u003e set data-attrName to the given value for all matched elements\n    append(content, ...)    -\u003e Append content ($dom instances, DOM nodes, or html strings) to each element\n    prepend(content, ...)   -\u003e Same as append(), but inserts at the front of the selection\n\n    // Traversal:\n    parent()                -\u003e Returns all unique parents of the selected elements\n    unique()                -\u003e Returns a unique set of the selected elements\n    first()                 -\u003e Returns the first selected element (wrapped)\n    last()                  -\u003e Returns the last selected element (wrapped)\n    closest(selector)       -\u003e Returns the closest ancestor that matches the given selector\n                               (NOTE! only supports simple tag name selectors for now)\n\n    // Classes and attributes:\n    addClass(className)\n    removeClass(className)\n    hasClass(className)     -\u003e returns true if any matched element has the given class\n    attr(name)              -\u003e return the attribute of the first matched element\n    attr(name, value)       -\u003e for all matched elements, set the attribute with the given name to the given value.\n    attr(hash)              -\u003e for each matched element, el[attrName] = attrValue for each key, val pair in the object\n    removeAttr(\u003cstring\u003e)\n\n    // Styling:\n    css(name)\n    css(name, value)\n    css(hash)\n    show()\n    hide()                  -\u003e Set \"display: none\" on all matched elements.\n\n    // Events:\n    on(eventName, handler)\n    on(eventName, delegationSelector, handler)\n    off(eventName, handler)\n    off(eventName, delegationSelector, handler)\n    trigger(eventName)           -\u003e trigger an event on each matched element\n    bind(), unbind(), delegate(), undelegate() (legacy)\n\n    // ES5 Array methods\n    each()\n    map()\n    some()\n    every()\n    filter()                -\u003e NOTE: works like the ES5 array method, not jquery's method\n\n    // Misc\n    toArray()               -\u003e Return the matching DOM nodes in an array\n\n```\n\n\n## TODO:\n    * Add support for:\n        .one()\n        .children()\n    * form serialization: to string, and to Object\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faf%2Flittledom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faf%2Flittledom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faf%2Flittledom/lists"}