Code coverage report for lib/parser/ast/textNode.js

Statements: 64.29% (9 / 14)      Branches: 50% (3 / 6)      Functions: 100% (2 / 2)      Lines: 64.29% (9 / 14)      Ignored: none     

All files » lib/parser/ast/ » textNode.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 321     1 7 7                         7   7     1     7       1  
var BaseExpression = require("./base");
// var he = require("he");
 
function TextNodeExpression(value) {
  Eif (global.paperclip && global.paperclip.he) {
    this.value = global.paperclip.he.decode(value);
  } else if (typeof window !== "undefined") {
    var div = document.createElement("div");
    div.innerHTML = value;
    this.value = div.textContent;
  } else {
    this.value = value;
  }
 
  // this.value = he.decode(value);
 
  // FIXME:
  // will be invalid if value is something like 'a'
  this.decoded = this.value !== value;
 
  BaseExpression.apply(this, arguments);
}
 
BaseExpression.extend(TextNodeExpression, {
  type: "textNode",
  toJavaScript: function() {
    return "text(\"" + this.value.replace(/["]/g, "\\\"") + "\")";
  }
});
 
module.exports = TextNodeExpression;