{"id":13800832,"url":"https://github.com/plumatic/dommy","last_synced_at":"2025-12-12T01:09:53.989Z","repository":{"id":6349473,"uuid":"7586000","full_name":"plumatic/dommy","owner":"plumatic","description":"A tiny ClojureScript DOM manipulation and event library","archived":false,"fork":false,"pushed_at":"2018-01-07T00:14:06.000Z","size":345,"stargazers_count":756,"open_issues_count":12,"forks_count":72,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-10-11T20:09:40.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","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/plumatic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-13T08:30:11.000Z","updated_at":"2025-10-02T22:42:56.000Z","dependencies_parsed_at":"2022-07-31T02:38:12.244Z","dependency_job_id":null,"html_url":"https://github.com/plumatic/dommy","commit_stats":null,"previous_names":["prismatic/dommy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/plumatic/dommy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plumatic%2Fdommy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plumatic%2Fdommy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plumatic%2Fdommy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plumatic%2Fdommy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plumatic","download_url":"https://codeload.github.com/plumatic/dommy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plumatic%2Fdommy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27673719,"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","status":"online","status_checked_at":"2025-12-11T02:00:11.302Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-08-04T00:01:16.745Z","updated_at":"2025-12-12T01:09:53.964Z","avatar_url":"https://github.com/plumatic.png","language":"Clojure","funding_links":[],"categories":["Awesome ClojureScript"],"sub_categories":["Document Object Model"],"readme":"\u003cimg src=\"resources/logo.png\" width=\"270\" /\u003e\n\nA ClojureScript DOM manipulation and event library.\n\n## Usage\n\nAdd the following dependency to your `project.clj`:\n\n```clojure\n[prismatic/dommy \"1.1.0\"]\n```\n\n#### Upgrading to 1.0.0+ from 0.X.Y\n\nVersion \"1.0.0\" includes breaking API changes. Here's a quick overview of what's\nchanged:\n\n*   `dommy.template` namespace and all related templating features\n    (`node`, `deftemplate`, etc) have been removed from the library.\n*   Simplified namespace structure.\n    Everything in `dommy.macros` and `dommy.attrs` has been moved into\n    `dommy.core`\n\nSee CHANGELOG.md or \u003chttps://github.com/plumatic/dommy/pull/85\u003e for more\ndetails.\n\nIf you are looking for hiccup-style templating features, check out https://github.com/jeluard/hipo/\n\n### Selection\n\nDOM nodes are selected using macros, which expand to the correct native dom calls. Because selectors don't wrap returned nodes, there is a distinction between single and multiple selections. A selector can be a keyword, string or vector.\n\n```clojure\n(ns foo.bar\n  (:require \n    [dommy.core :refer-macros [sel sel1]]))\n\n(sel1 :body) ; =\u003e document.body\n(sel1 :#header) ; =\u003e document.getElementById(\"header\")\n(sel1 \".todo\") ; =\u003e document.getElementsByClassName(\"todo\")[0]\n\n(sel [:#todos :li]) ; =\u003e document.querySelectorAll(\"#todos li\")\n```\n\nSometimes its useful to specify the base node from which the selection takes place.\n\n```clojure\n(sel1 todos-element :.todo)\n```\n\n### DOM Manipulation\n\nInspired by [jQuery](http://jquery.com), but adapted to be functional in order to better fit with ClojureScript core.\n\n```clojure\n(dommy/append! (sel1 :#todos) todo-element)\n\n(doseq [todo (sel :.todo)]\n  (dommy/add-class! todo :complete))\n\n(map dommy/text (sel :.todo))\n```\n\nFunctions that modify take the target node as their first argument, and return the same modified node, allowing the use of threading macros to accomplish jQuery-like chaining.\n\n```clojure\n(-\u003e (sel1 :#my-button)\n\t(dommy/remove-attr! :disabled)\n\t(dommy/add-class! :active)\n\t(dommy/set-text! \"Click me!\"))\n\n(-\u003e\u003e (sel :.image)\n\t (filter #(\u003e (dommy/px % :width) 500))\n\t (map #(dommy/add-class! % :big-image)))\n```\n\n### Events\n\nDommy's event API closely resembles the native JavaScript API.\n\n```clojure\n(ns foo.bar\n  (:require\n    [dommy.core :as dommy :refer-macros [sel1]]))\n\n(defn click-handler [e]\n    (.log js/console \"You clicked my button! Congratulations\"))\n\n(dommy/listen! (sel1 :#my-button) :click click-handler)\n\n(dommy/unlisten! (sel1 :#my-button) :click click-handler)\n```\n\nIf the first argument to `listen!` is a sequence, the handler will delegate events to the selected element defined by the sequence. A special property `selectedTarget` added to the event specifies the element selected.\n\n```clojure\n(defn todo-click-handler [e]\n  (.log js/console \"The clicked todo is\" (.-selectedTarget e)))\n\n(dommy/listen! [todos-element :.todo] :click todo-click-handler))\n```\n\n## Testing\n\nFor all pull requests, please ensure your tests pass (or add test cases) before submitting. \n\n    $ lein cljsbuild test\n\n## License\n\nCopyright (C) 2014 Prismatic\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplumatic%2Fdommy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplumatic%2Fdommy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplumatic%2Fdommy/lists"}