Skip to content
Snippets Groups Projects
Commit d9216c8b authored by Commander-lol's avatar Commander-lol
Browse files

extended parent search to climb tree with selector

parent 487282f2
No related branches found
No related tags found
No related merge requests found
......@@ -126,8 +126,20 @@
return null;
}
},
parent: function() {
return tinyDOM(this[0].parentNode);
parent: function(selector) {
var e = this[0].parentNode, stn = true;
if (tinyDOM.exists(selector)) {
while (e != null && e != document) {
if (e.matches(selector)) {
stn = false;
break;
} else {
e = e.parentNode;
}
}
e = stn ? null : e;
}
return tinyDOM(e);
},
children: function() {
var n = this[0].childNodes,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment