incremental-dom

WebJar for incremental-dom

License

License

Categories

Categories

Github Development Tools Version Controls
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

github-com-google-incremental-dom
Last Version

Last Version

0.5.2
Release Date

Release Date

Type

Type

jar
Description

Description

incremental-dom
WebJar for incremental-dom
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/google/incremental-dom

Download github-com-google-incremental-dom

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/github-com-google-incremental-dom/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>github-com-google-incremental-dom</artifactId>
    <version>0.5.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-google-incremental-dom/
implementation 'org.webjars.npm:github-com-google-incremental-dom:0.5.2'
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-google-incremental-dom/
implementation ("org.webjars.npm:github-com-google-incremental-dom:0.5.2")
'org.webjars.npm:github-com-google-incremental-dom:jar:0.5.2'
<dependency org="org.webjars.npm" name="github-com-google-incremental-dom" rev="0.5.2">
  <artifact name="github-com-google-incremental-dom" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='github-com-google-incremental-dom', version='0.5.2')
)
libraryDependencies += "org.webjars.npm" % "github-com-google-incremental-dom" % "0.5.2"
[org.webjars.npm/github-com-google-incremental-dom "0.5.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

CircleCI

Incremental DOM

Overview

Incremental 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.

Incremental 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. Think of it as ASM.dom.

Supported Browsers

Incremental DOM supports IE9 and above.

Usage

HTML is expressed in Incremental DOM using the elementOpen, elementClose, elementVoid and text methods. Consider the following example:

var IncrementalDOM = require('incremental-dom'),
    elementOpen = IncrementalDOM.elementOpen,
    elementClose = IncrementalDOM.elementClose,
    elementVoid = IncrementalDOM.elementVoid,
    text = IncrementalDOM.text;

function render(data) {
  elementVoid('input', '', [ 'type', 'text' ]);
  elementOpen('div', '', null);
    if (data.someCondition) {
      text(data.text);
    }
  elementClose('div');
}

To render or update an existing DOM node, the patch function is used:

var patch = require('incremental-dom').patch;

var data = {
  text: 'Hello World!',
  someCondition: true
};

patch(myElement, function() {
  render(data);
});

data.text = 'Hello World!';

patch(myElement, function() {
  render(data);
});

Templating Languages and Libraries

Check out what others having been doing with Incremental DOM.

Docs

Getting Incremental DOM

Via CDN

https://ajax.googleapis.com/ajax/libs/incrementaldom/0.5.1/incremental-dom.js https://ajax.googleapis.com/ajax/libs/incrementaldom/0.5.1/incremental-dom-min.js

Using npm

npm install incremental-dom

Development

To install the required development packages, run the following command:

npm i

Running tests

To run once:

./node_modules/.bin/bazel test ...

To run on change:

./node_modules/.bin/ibazel run ...

Building

To build once:

./node_modules/.bin/bazel build ...

To build on change:

./node_modules/.bin/ibazel ...
org.webjars.npm

Google

Google ❤️ Open Source

Versions

Version
0.5.2