Code coverage report for src/helpers/dom.coffee

Statements: 88.24% (15 / 17)      Branches: 80% (12 / 15)      Functions: 100% (3 / 3)      Lines: 88.24% (15 / 17)      Ignored: none     

All files » src/helpers/ » dom.coffee
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   111× 111× 111×     113×   111× 38×   73×                        
module.exports = {
  matches: function(el, selector) {
    var method;
    method = el.matches || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector || el.webkitMatchesSelector;
    return method != null ? method.call(el, selector) : void 0;
  },
  closest: function(el, selector) {
    if (!el) {
      return null;
    }
    if (this.matches(el, selector)) {
      return el;
    } else {
      return this.closest(el.parentNode, selector);
    }
  },
  readBootstrapData: function(root) {
    var el;
    Iif (root == null) {
      root = document;
    }
    el = root.querySelector('#tutor-boostrap-data');
    Eif (el) {
      el.parentNode.removeChild(el);
      return JSON.parse(el.textContent);
    } else {
      return {};
    }
  }
};