ModelChain

ModelChain

Allows updating of models

Constructor

new ModelChain(definition)

Source:
Example
import { ModelChain } from "domodel"

const MyModel = {
	tagName: "div",
	children: [{
		tagName: "div",
		identifier: "title"
	}]
}

const MyModelChain = new ModelChain(MyModel).after("title", {
	tagName: "div",
	textContent: "A description"
})

Core.run(MyModelChain.definition, { target: document.body })
Parameters:
Name Type Description
definition Model

Members

definition :Model

Source:
Type:

Methods

prepend(parentIdentifieropt, definition) → {ModelChain}

Source:
Parameters:
Name Type Attributes Description
parentIdentifier string <optional>
definition Model
Returns:
Type
ModelChain

append(parentIdentifieropt, definition) → {ModelChain}

Source:
Parameters:
Name Type Attributes Description
parentIdentifier string <optional>
definition Model
Returns:
Type
ModelChain

replace(identifier, definition) → {ModelChain}

Source:
Parameters:
Name Type Description
identifier string
definition Model
Returns:
Type
ModelChain

before(identifier, definition) → {ModelChain}

Source:
Parameters:
Name Type Description
identifier string
definition Model
Returns:
Type
ModelChain

after(identifier, definition) → {ModelChain}

Source:
Parameters:
Name Type Description
identifier string
definition Model
Returns:
Type
ModelChain