Blueprint

Type: Class

How to get Blueprint?

JavaScript

import Blueprint from 'fontoxml-blueprints/src/Blueprint.js'

A blueprint provides a layer over the actual dom in which it is possible to change the structure without affecting the actual document.

Besides this, it is possible to make new overlays in which mutations can be made, validated, and possibly be reverted. This is especially useful when writing mutations which have to try multiple things.

Constructor arguments

  1. dom

    (Required)

    Type: Dom | LocalDom

    The dom on which this blueprint operates. Accepts both the global Dom as well as a LocalDom proxy for backwards compatibility.

  2. useHookRunner

    (Required)

    Type: Boolean

    Default value

  3. isolated

    (Required)

    Type: Boolean

    Default value

Methods

adoptNode

Type: Function

Moves node from another document and returns it. This makes configuration from the new document apply to node.

In general it is not necessary to call adoptNode, as moving the node to a new document will do this automatically, and most configuration-dependent APIs (including validation) will not work reliably for nodes that are not in a document tree.

Arguments

Returns

appendChild

Type: Function

Append a child to the parentNode, inserting it as the last child. Shorthand for insertBefore(parentnode, node, null);

Arguments

Returns

applyOverlay

Type: Function

Makes all mutations performed during the current overlay permanent.

beginOverlay

Type: Function

Begins a blueprint overlay. All operations performed while an overlay is active can be reversed if the overlay is discarded or made permanent if the overlay is accepted.

cloneNode

Type: Function

Create a full clone from the given node, from the context in this blueprint.

Because of the implementation of nodeId, the userData will not be cloned.

Arguments

Returns

discardOverlay

Type: Function

Discards all mutations performed during the current overlay, reverting the Blueprint to the state before the overlay was started.

getAllAttributes

Type: Function

Get all the attributes of this node, including attributes which are only known in the Blueprint

Arguments

Returns

getAttribute

Type: Function

Returns the value of the given node's attribute with the given name

Arguments

Returns

getAttributeNodeNS

Type: Function

Returns node's attribute with the given namespace and local name

Arguments

Returns

getAttributeNS

Type: Function

Returns the value of the given node's attribute with the given namespace and local name

Arguments

Returns

getChildNodes

Type: Function

Returns the child nodes of the given node according to the blueprint.

Arguments

Returns

getData

Type: Function

Returns the data for the given node according to the Blueprint.

Arguments

Returns

getFirstChild

Type: Function

Returns the first child of the given node according to the blueprint.

Arguments

Returns

getLastChild

Type: Function

Returns the last child of the given node according to the blueprint.

Arguments

Returns

getNextSibling

Type: Function

Returns the next sibling of the given node according to the blueprint.

Arguments

Returns

getOwnerDocument

Type: Function

Returns the owner document of the given node according to the blueprint.

If the node is itself a Document, the owner document is null. Use blueprintQuery.getDocumentNode if you want the node itself in that case.

Arguments

Returns

getParentNode

Type: Function

Returns the parent node of the given node according to the blueprint.

If the node is an attribute, the ownerElement is returned.

Arguments

Returns

getPreviousSibling

Type: Function

Returns the previous sibling of the given node according to the blueprint.

Arguments

Returns

insertBefore

Type: Function

Inserts the given node at the given position in the DOM represented by the Blueprint.

This function removes the given node you are moving and this makes all positions inside the node collapse to its old location. If you need to preserve positions, please check unsafeMoveNodes.

Arguments

Returns

lookup

Type: Function

Look up the node with the given ID.

Arguments

Returns

removeAttribute

Type: Function

Removes the given node's attribute with the given name.

Arguments

removeAttributeNode

Type: Function

Removes the given node's attribute

Arguments

removeAttributeNS

Type: Function

Removes the given node's attribute with the given namespace and local name

Arguments

removeChild

Type: Function

Removes the given node from its parent in the DOM represented by the Blueprint.

Arguments

Returns

replaceChild

Type: Function

Replaces the given node with another node in the DOM represented by the Blueprint.

Arguments

Returns

replaceData

Type: Function

Replace a part of the data of the node by starting from an offset.

Arguments

setAttribute

Type: Function

Sets the value of the given node's attribute with the given name to the given value.

Arguments

setAttributeNS

Type: Function

Sets the value of the given node's attribute with the given namespace and qualified name to the given value.

Arguments

setData

Type: Function

Sets the data for the given node according to the Blueprint.

Arguments

splitText

Type: Function

Splits the given text node in two.

Positions in node beyond the split point will be moved into the second half. The position at the split point remains at the end of node.

Arguments

Returns