Improved compatibility with "How Many Times Can I Back?" (#397)

"getCommonAncestor" method is not available without jQuery
This commit is contained in:
wanabe 2013-09-12 12:36:00 +09:00
parent 6bce4e5e19
commit 1a83376034

View File

@ -1079,10 +1079,16 @@ TreeStyleTabBrowser.prototype = {
namedNodes.closeAnchor = namedNodes.label;
if (namedNodes.closeAnchor.parentNode != namedNodes.close.parentNode) {
let containerFinder = d.createRange();
containerFinder.selectNode(namedNodes.closeAnchor);
containerFinder.setEndAfter(namedNodes.close);
let container = containerFinder.getCommonAncestor();
let containerFinder = namedNodes.closeAnchor;
let containers = [];
while (containerFinder != aTab) {
containerFinder = containerFinder.parentNode;
containers.push(containerFinder);
}
let container = namedNodes.close;
while (containers.indexOf(container) < 0) {
container = container.parentNode;
}
while (namedNodes.closeAnchor.parentNode != container)
{
namedNodes.closeAnchor = namedNodes.closeAnchor.parentNode;