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
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.
use
Hook Runner (Required)
Type: Boolean
Default value
isolated
(Required)
Type: Boolean
Default value
Methods
adopt Node
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
append Child
Type: Function
Append a child to the parentNode, inserting it as the last child. Shorthand for insertBefore(parentnode, node, null);
Arguments
Returns
apply Overlay
Type: Function
Makes all mutations performed during the current overlay permanent.
begin Overlay
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.
clone Node
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
discard Overlay
Type: Function
Discards all mutations performed during the current overlay, reverting the Blueprint to the state before the overlay was started.
get All Attributes
Type: Function
Get all the attributes of this node, including attributes which are only known in the Blueprint
Arguments
Returns
get Attribute
Type: Function
Returns the value of the given node's attribute with the given name
Arguments
Returns
get Attribute Node NS
Type: Function
Returns node's attribute with the given namespace and local name
Arguments
Returns
get Attribute NS
Type: Function
Returns the value of the given node's attribute with the given namespace and local name
Arguments
Returns
get Child Nodes
Type: Function
Returns the child nodes of the given node according to the blueprint.
Arguments
Returns
get Data
Type: Function
Returns the data for the given node according to the Blueprint.
Arguments
Returns
get First Child
Type: Function
Returns the first child of the given node according to the blueprint.
Arguments
Returns
get Last Child
Type: Function
Returns the last child of the given node according to the blueprint.
Arguments
Returns
get Next Sibling
Type: Function
Returns the next sibling of the given node according to the blueprint.
Arguments
Returns
get Owner Document
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
get Parent Node
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
get Previous Sibling
Type: Function
Returns the previous sibling of the given node according to the blueprint.
Arguments
Returns
insert Before
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
remove Attribute
Type: Function
Removes the given node's attribute with the given name.
Arguments
remove Attribute Node
Type: Function
Removes the given node's attribute
Arguments
remove Attribute NS
Type: Function
Removes the given node's attribute with the given namespace and local name
Arguments
remove Child
Type: Function
Removes the given node from its parent in the DOM represented by the Blueprint.
Arguments
Returns
replace Child
Type: Function
Replaces the given node with another node in the DOM represented by the Blueprint.
Arguments
Returns
replace Data
Type: Function
Replace a part of the data of the node by starting from an offset.
Arguments
set Attribute
Type: Function
Sets the value of the given node's attribute with the given name to the given value.
Arguments
set Attribute NS
Type: Function
Sets the value of the given node's attribute with the given namespace and qualified name to the given value.
Arguments
set Data
Type: Function
Sets the data for the given node according to the Blueprint.
Arguments
split Text
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