code: function(node, child) {
        var hasContains = (window.Node && window.Node.prototype && Node.prototype.contains);
        var findFn = hasContains ? angular.bind(node, node.contains) : angular.bind(node, function(arg) {
          // compares the positions of two nodes and returns a bitmask
          return (node === child) || !!(this.compareDocumentPosition(arg) & 16);
        });
  
        return findFn(child);
      }
docs: Build polyfill for the Node.contains feature (if needed)
  @param {Node} node
  @param {Node} child
  @returns {Node}