importNodes

Type: Function

Inserts a list of nodes at the given position, unwrapping the ancestors one level at a time, until we can validly insertNodes the root nodes.

This is useful for importing things in a situation where at least the text nodes should be retained, but an outer level may already exist. Note: this primitive will insert until only textNodes / comments / PIs are left, possibly removing more than you'd want.

Other

Example, when given the following DOM:     And the following nodes:
   O                                         A    A      A
   '-- Insert here                         /  \   |    /  \
                                          B    B '..' B  '..'
                                          |    |
                                        '..'  '..'

An import will attempt the following insert:

Other

           O
         / | \
        /  |  \
       /   |   \
      A    A    A
    /  \   |    | \
   B    B '..'  B '..'
   |     |
 '..'  '..'

Assuming this will fail, the following will be attempted:

Other

           O
         / | \
        /  |  \
       /   |   \
     /  \  |    | \
   B    B '..'  B '..'
   |     |
 '..'  '..'

After that, the following (last possible configuration of nodes):

Other

           O
         / | \
        /\  \  \
      /   |  \   \
   '..' '..' '..' '..'

Refer to primitives for more information on how to include this primitive.

Arguments

  1. insertionPosition

    (Required)

  2. nodes

    (Required)

    Type: Array<Node>

  3. blueprint

    (Required)

    Type: Blueprint

  4. format

    (Required)

    Type: Format

  5. positionAfterInsert

    (Required)

    Placed after the last inserted node, under the insertionPosition.container, or one of its ancestors

Returns

Type: Boolean

The result of the primitive