# Code coverage report for lib/section/fragment.js

## Statements: 100% (16 / 16) Branches: 100% (0 / 0) Functions: 100% (6 / 6) Lines: 100% (16 / 16) Ignored: none

All files » lib/section/ » fragment.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    611

    1
    626

    1

    73

    90

    73
    73

    1
    90
    90
    90

    1

    49

    49

    1

     var DocumentSection = require("document-section").Section,
    protoclass          = require("protoclass"),
    utils               = require("../utils");

    function FragmentSection (nodeFactory, start, end) {
      DocumentSection.call(this, nodeFactory, start, end);
    }

    DocumentSection.extend(FragmentSection, {

      /**
       */

      rootNode: function () {
        return this.start.parentNode;
      },

      /**
       */

      createMarker: function () {
        return new Marker(this.nodeFactory, utils.getNodePath(this.start), utils.getNodePath(this.end));
      },

      /**
       */

      clone: function () {
        var clone = DocumentSection.prototype.clone.call(this);
        return new FragmentSection(this.nodefactory, clone.start, clone.end);
      }
    });

    function Marker (nodeFactory, startPath, endPath) {
      this.nodeFactory = nodeFactory;
      this.startPath   = startPath;
      this.endPath     = endPath;
    }

    protoclass(Marker, {

      /**
       */

      getSection: function (rootNode) {

        var start = utils.getNodeByPath(rootNode, this.startPath),
        end       = utils.getNodeByPath(rootNode, this.endPath);

        return new FragmentSection(this.nodeFactory, start, end);
      }
    });

    module.exports = FragmentSection;