# Code coverage report for lib/template/vnode/text/index.js

## Statements: 88.89% (8 / 9) Branches: 50% (1 / 2) Functions: 100% (3 / 3) Lines: 88.89% (8 / 9) Ignored: none

All files » lib/template/vnode/text/ » index.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    221

    1
    88

    1

    137

    137

    1
    88
     var protoclass = require("protoclass")

    function Text (value) {
      this.value = value;
    }

    module.exports = protoclass(Text, {
      initialize: function (scope) {

        // blank text nodes are NOT allowed. Chrome has an issue rendering
        // blank text nodes - way, WAY slower if this isn't here!
        Iif (/^\s+$/.test(this.value)) {
          return scope.nodeFactory.createTextNode("\u00A0");
        };

        return scope.nodeFactory.createTextNode(this.value);
      }
    });

    module.exports.create = function (value) {
      return new Text(value);
    }