All files utils.js

100% Statements 43/43
100% Branches 29/29
100% Functions 8/8
100% Lines 38/38

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 611x   1x 1x 1x 1x 1x 1x 1x   1x 60x     1x 60x 55x     1x 6x 6x 3x 5x 3x     1x 4570x     1x 63x 188x   13x     1x 4x     1x 2x     1x 1501x 1501x 416x 89x   327x 327x 1209x   1412x        
var Utils = {};
 
Utils.CARET = "\\xmlClass{cursor}{\\hspace{0pt}}";
Utils.TEMP_SMALL_CARET = "\\xmlClass{cursor}{\\hspace{0pt}}";
Utils.TEMP_CARET = "\\xmlClass{cursor}{\\hspace{0pt}}";
Utils.SMALL_CARET = "\\xmlClass{cursor}{\\hspace{0pt}}";
Utils.SEL_CARET = "\\xmlClass{cursor}{\\hspace{0pt}}";
Utils.SMALL_SEL_CARET = "\\xmlClass{cursor}{\\hspace{0pt}}";
Utils.SEL_COLOR = "red";
 
Utils.is_blank = function(n){
    return n.firstChild == null || n.firstChild.nodeValue == '';
}
 
Utils.get_length = function(n){
    if(Utils.is_blank(n) || n.nodeName == 'f') return 0
    return n.firstChild.nodeValue.length;
}
 
Utils.path_to = function(n){
    var name = n.nodeName;
    if(name == "m") return "guppy_loc_m";
    var ns = 0;
    for(var nn = n; nn != null; nn = nn.previousSibling) if(nn.nodeType == 1 && nn.nodeName == name) ns++;
    return Utils.path_to(n.parentNode)+"_"+name+""+ns;
}
 
Utils.is_text = function(nn){
    return nn.parentNode.hasAttribute("mode") && (nn.parentNode.getAttribute("mode") == "text" || nn.parentNode.getAttribute("mode") == "symbol");
}
 
Utils.is_char = function(nn){
    for(var n = nn.firstChild; n; n = n.nextSibling){
	if(n.nodeName == "c" || n.nodeName == "l") return false;
    }
    return true;
}
 
Utils.is_symbol = function(nn){
    return nn.parentNode.getAttribute("mode") && nn.parentNode.getAttribute("mode") == "symbol";
}
 
Utils.is_utf8entry = function(nn){
    return nn.parentNode.getAttribute("utf8") && nn.parentNode.getAttribute("utf8") == "entry";
}
 
Utils.is_small = function(nn){
    var n = nn.parentNode;
    while(n != null && n.nodeName != 'm'){
        if(n.getAttribute("small") == "yes"){
            return true;
        }
        n = n.parentNode
        while(n != null && n.nodeName != 'c')
            n = n.parentNode;
    }
    return false;
}
 
export default Utils;