{"id":13454113,"url":"https://github.com/google/incremental-dom","last_synced_at":"2025-05-13T23:09:02.455Z","repository":{"id":33631424,"uuid":"37283747","full_name":"google/incremental-dom","owner":"google","description":"An in-place DOM diffing library","archived":false,"fork":false,"pushed_at":"2024-06-19T05:44:46.000Z","size":1971,"stargazers_count":3545,"open_issues_count":63,"forks_count":179,"subscribers_count":81,"default_branch":"master","last_synced_at":"2025-05-13T03:01:40.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://google.github.io/incremental-dom/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-11T20:15:03.000Z","updated_at":"2025-05-07T11:37:25.000Z","dependencies_parsed_at":"2023-02-15T11:16:09.110Z","dependency_job_id":"fc8d8694-e1ca-410c-9363-dc6c4d213fc7","html_url":"https://github.com/google/incremental-dom","commit_stats":{"total_commits":362,"total_committers":58,"mean_commits":6.241379310344827,"dds":0.569060773480663,"last_synced_commit":"3be2338cb18bce102b65a2df3d22add2680fc13e"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fincremental-dom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fincremental-dom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fincremental-dom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fincremental-dom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/incremental-dom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254041954,"owners_count":22004810,"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-07-31T08:00:50.984Z","updated_at":"2025-05-13T23:08:57.445Z","avatar_url":"https://github.com/google.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","others","\u003ca id=\"1d9dec1320a5d774dc8e0e7604edfcd3\"\u003e\u003c/a\u003e工具-新添加的"],"sub_categories":["\u003ca id=\"8f1b9c5c2737493524809684b934d49a\"\u003e\u003c/a\u003e文章\u0026\u0026视频"],"readme":"[![CircleCI](https://circleci.com/gh/google/incremental-dom.svg?style=svg)](https://circleci.com/gh/google/incremental-dom)\n\n# Incremental DOM\n\n## Overview\n\nIncremental DOM is a library for building up DOM trees and updating them in-place when data changes. It differs from the established virtual DOM approach in that no intermediate tree is created (the existing tree is mutated in-place). This approach significantly reduces memory allocation and GC thrashing for incremental updates to the DOM tree therefore increasing performance significantly in some cases.\n\nIncremental DOM is primarily intended as a compilation target for templating languages. It could be used to implement a higher level API for human consumption. The API was carefully designed to minimize heap allocations and where unavoidable ensure that as many objects as possible can be de-allocated by incremental GC. One unique feature of its API is that it separates opening and closing of tags so that it is suitable as a compilation target for templating languages that allow (temporarily) unbalanced HTML in templates (e.g. tags that are opened and closed in separate templates) and arbitrary logic for creating HTML attributes.\n*Think of it as ASM.dom.*\n\n## Supported Browsers\n\nIncremental DOM supports IE9 and above.\n\n## Usage\n\nHTML is expressed in Incremental DOM using the `elementOpen`, `elementClose`, `elementVoid` and `text` methods. Consider the following example:\n\n```javascript\nvar IncrementalDOM = require('incremental-dom'),\n    elementOpen = IncrementalDOM.elementOpen,\n    elementClose = IncrementalDOM.elementClose,\n    elementVoid = IncrementalDOM.elementVoid,\n    text = IncrementalDOM.text;\n\nfunction render(data) {\n  elementVoid('input', '', [ 'type', 'text' ]);\n  elementOpen('div', '', null);\n    if (data.someCondition) {\n      text(data.text);\n    }\n  elementClose('div');\n}\n```\n\nTo render or update an existing DOM node, the patch function is used:\n\n\n```javascript\nvar patch = require('incremental-dom').patch;\n\nvar data = {\n  text: 'Hello World!',\n  someCondition: true\n};\n\npatch(myElement, function() {\n  render(data);\n});\n\ndata.text = 'Hello World!';\n\npatch(myElement, function() {\n  render(data);\n});\n```\n\n## Templating Languages and Libraries\n\n[Check out](ECOSYSTEM.md)  what others having been doing with Incremental DOM.\n\n## Docs\n\n- [Introducing Incremental Dom](https://medium.com/google-developers/introducing-incremental-dom-e98f79ce2c5f)\n- [Docs and demos](http://google.github.io/incremental-dom/)\n\n## Getting Incremental DOM\n\n### Via CDN\n\nhttps://ajax.googleapis.com/ajax/libs/incrementaldom/0.5.1/incremental-dom.js\nhttps://ajax.googleapis.com/ajax/libs/incrementaldom/0.5.1/incremental-dom-min.js\n\n### Using npm\n\n```sh\nnpm install incremental-dom\n```\n\n## Development\n\nTo install the required development packages, run the following command:\n\n```sh\nnpm i\n```\n\n### Running tests\n\nTo run once:\n\n```sh\n./node_modules/.bin/bazelisk test ...\n```\n\nTo run on change:\n\n```sh\n./node_modules/.bin/ibazel run //test:unit_tests\n```\n\n### Building\n\nTo build once:\n\n```sh\n./node_modules/.bin/bazelisk build ...\n```\n\nTo build on change:\n\n```sh\n./node_modules/.bin/ibazel build ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fincremental-dom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fincremental-dom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fincremental-dom/lists"}