{"id":19388807,"url":"https://github.com/james2doyle/jquery-morphdom","last_synced_at":"2025-06-15T05:35:43.266Z","repository":{"id":57282242,"uuid":"52799097","full_name":"james2doyle/jquery-morphdom","owner":"james2doyle","description":"A jQuery wrapper for morphdom - a fast and lightweight DOM diffing/patching (without the virtual part)","archived":false,"fork":false,"pushed_at":"2016-09-21T18:25:37.000Z","size":17,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T23:39:12.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/james2doyle.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":"2016-02-29T14:50:48.000Z","updated_at":"2023-07-02T02:52:40.000Z","dependencies_parsed_at":"2022-09-19T15:02:53.327Z","dependency_job_id":null,"html_url":"https://github.com/james2doyle/jquery-morphdom","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/james2doyle/jquery-morphdom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fjquery-morphdom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fjquery-morphdom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fjquery-morphdom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fjquery-morphdom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/james2doyle","download_url":"https://codeload.github.com/james2doyle/jquery-morphdom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fjquery-morphdom/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259927060,"owners_count":22933143,"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-11-10T10:13:47.417Z","updated_at":"2025-06-15T05:35:43.242Z","avatar_url":"https://github.com/james2doyle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jquery-morphdom\n\nA jQuery wrapper for [morphdom](https://github.com/patrick-steele-idem/morphdom/) - a fast and lightweight DOM diffing/patching (without the virtual part)\n\n### About Morphdom\n\n\u003e Lightweight module for morphing an existing DOM node tree to match a target DOM node tree. It's fast and works with the real DOM no virtual-DOM here!\n\nIf you need more information, check the [morphdom repo](https://github.com/patrick-steele-idem/morphdom/#morphdom).\n\n### Usage\n\nThis library can be used to instead of `.html` or `.replaceWith`, but keep in mind that this **replaces** the item itself, not just the inside contents. So it is much more like `.replaceWith`.\n\n```js\n// this is how .html works\n$('#somediv').html(\"\u003cdiv id=\\\"newdiv\\\"\u003eI will be inside #somediv\u003c/div\u003e\");\n\n// this is how .replaceWith and .morphdom work\n$('#somediv').replaceWith(\"\u003cdiv id=\\\"newdiv\\\"\u003eI will replace #somediv\u003c/div\u003e\");\n$('#somediv').morphdom(\"\u003cdiv id=\\\"newdiv\\\"\u003eI will replace #somediv\u003c/div\u003e\");\n```\n\n### Example\n\nSee the [example.html](https://github.com/james2doyle/jquery-morphdom/blob/master/example.html) for the full use case.\n\n```js\njQuery(document).ready(function ($) {\n    // replace #div with #newid\n    $('#div').morphdom(\"\u003cdiv id=\\\"newid\\\"\u003eNew Text\u003c/div\u003e\");\n\n    // replace the first li with the last one\n    $('ul').find('li').first().morphdom($('ul').find('li').last());\n\n    // replaces #fetched with the contents of partial.html\n    $.get('partial.html', function (data, textStatus, jqXHR) {\n        $('#fetched').find('.item').morphdom(data);\n    });\n});\n```\n\n### Usage With Require\n\nPlease see this [requirebin project](http://requirebin.com/?gist=9e417680ef14abd2a3c379cd366a8eed).\n\n### Use Cases\n\n* loading form data via AJAX\n* partial content, replacing other content\n* AJAX pagination\n* timeout changes to HTML\n* updates to DOM for `input` events\n* sortable display of elements\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fjquery-morphdom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjames2doyle%2Fjquery-morphdom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fjquery-morphdom/lists"}