var matches = require('matches-selector')

module.exports = function (element, selector, checkYoSelf) {
  var parent = checkYoSelf ? element : element.parentNode

  while (parent && parent !== document) {
    if (matches(parent, selector)) return parent;
    parent = parent.parentNode
  }
}

@@ -36,10 +36,14 @@
 ctor
+-ng
 ')
+;
 %0A%0Amo
@@ -88,21 +88,8 @@
 ctor
-, checkYoSelf
 ) %7B%0A
@@ -107,91 +107,21 @@
 t = 
-checkYoSelf ? element : element.parentNode%0A%0A  while (parent && parent !== document)
+element;%0A  do
  %7B%0A 
@@ -203,11 +203,51 @@
 Node
+;
 %0A  %7D
+ while (parent && parent !== document);
 %0A%7D%0A

update code to require element parameter, and drop 3rd parameter.