Takes two arguments:
parentNodeof that selector.
.bar with parent element
.foo, you would do:
queryParent('.bar', '.foo'); // => Returns `.foo`.
Check out a demo of it here:
Why is it better than
.contains() will not work easily in cases where there are multiple similar parent selectors.
For an example of what that means see the above fiddle.
It is available via
npm for new-school kids (es6):
Or RawGit for old-school kids (es5):