.parents() without jquery - or querySelectorAll for parents [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Check event.target.parentElement with matchesSelector js I have a dom object, I'd like to match its parents, all parents, against a selector, like querySelectAll() , but for parents instead of children. Similar to jQuery's .parents('selector') method, but I do NOT need any back-wards compatibility. Also, no libraries please. I will totes take a boolean return value. I CAN write this myself as a recursive