BlueprintPosition

How to get BlueprintPosition

ES2015+:

import BlueprintPosition from 'fontoxml-blueprints/BlueprintPosition'

ES5:

define([
	'fontoxml-blueprints/BlueprintPosition'
], function (
	BlueprintPosition
) {
});

Type: Class

A blueprintPosition represents a position under a Node, in the DOM. Unlike ranges, it is not updated by dom changes: an offset which is out of range for the containing node is accepted.

Use the named constructor functions to create an instance of a BlueprintPosition.

Constructor

# Name Type Description
1. parentNode
2. offset
3. blueprint

Static methods

Name Description
fromOffset

Create a BlueprintPosition from an offset


  Arguments
# Name Type Description
1. container Node
2. offset Number
3. blueprint Blueprint
  Returns
fromRangeEnd

Create a BlueprintPosition positioned at the end of the given range


  Arguments
# Name Type Description
1. range BlueprintRange
2. blueprint Blueprint
  Returns
fromRangeStart

Create a BlueprintPosition positioned at the start of the given range


  Arguments
# Name Type Description
1. range BlueprintRange
2. blueprint Blueprint
  Returns
fromReferenceNode

Create a BlueprintPosition from a reference node.


  Arguments
# Name Type Description
1. container Node
2. referenceNode Node
3. blueprint Blueprint
  Returns

Properties

Name Type Description
container Node

The container of this position

data String

The data of the container of this position, if it is inside a data node

nextSibling Node | Null

The node after this position

offset Number

The offset of this position

parentNode Node

The container of this position

previousSibling Node | Null

The node before this position

Methods

Name Description
clone

Clone this position


  Returns
setAfter

Move this position to be after the given node


  Arguments
# Name Type Description
1. node Node
  Returns

Type: Boolean

This method returns false if the given node has no parentNode

setAtBegin

Move this position to be at the begin of the given node


  Arguments
# Name Type Description
1. node Node
  Returns

Type: Boolean

setAtEnd

Move this position to be at the end of the given node


  Arguments
# Name Type Description
1. node Node
  Returns

Type: Boolean

setAtOffset

Move this position to be at the given offset


  Arguments
# Name Type Description
1. container Node
2. offset Number
  Returns

Type: Boolean

This method returns false if the position is out-of-range

setBefore

Move this position to be before the given node


  Arguments
# Name Type Description
1. node Node
  Returns

Type: Boolean

This method returns false if the given node has no parentNode

setRelativeToNodes

Move this position to be before the given reference node


  Arguments
# Name Type Description
1. parentNode Node
2. referenceNode Node | Null
  Returns

Type: Boolean