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; namedNodes.closeAnchor = namedNodes.label;
if (namedNodes.closeAnchor.parentNode != namedNodes.close.parentNode) { if (namedNodes.closeAnchor.parentNode != namedNodes.close.parentNode) {
let containerFinder = d.createRange(); let containerFinder = namedNodes.closeAnchor;
containerFinder.selectNode(namedNodes.closeAnchor); let containers = [];
containerFinder.setEndAfter(namedNodes.close); while (containerFinder != aTab) {
let container = containerFinder.getCommonAncestor(); containerFinder = containerFinder.parentNode;
containers.push(containerFinder);
}
let container = namedNodes.close;
while (containers.indexOf(container) < 0) {
container = container.parentNode;
}
while (namedNodes.closeAnchor.parentNode != container) while (namedNodes.closeAnchor.parentNode != container)
{ {
namedNodes.closeAnchor = namedNodes.closeAnchor.parentNode; namedNodes.closeAnchor = namedNodes.closeAnchor.parentNode;