Detect reference node with XPath

This commit is contained in:
YUKI Hiroshi 2016-06-21 17:07:45 +09:00 committed by oonuma ryouyu
parent b6f36402c3
commit 998850b21e

View File

@ -981,7 +981,12 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
let insertAfter = item.getAttribute('multipletab-insertafter'); let insertAfter = item.getAttribute('multipletab-insertafter');
if (insertAfter) { if (insertAfter) {
try { try {
(new Function('return refNode = ('+insertAfter+').nextSibling'))(); refNode = utils.evaluateXPath(
insertAfter.replace(/^\s*xpath:\s*/i, ''),
tabContextMenu,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue;
if (refNode) refNode = refNode.nextSibling;
} }
catch(e) { catch(e) {
} }
@ -989,7 +994,11 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
let insertBefore = item.getAttribute('multipletab-insertbefore'); let insertBefore = item.getAttribute('multipletab-insertbefore');
if (refNode === void(0) && insertBefore) { if (refNode === void(0) && insertBefore) {
try { try {
(new Function('return refNode = '+insertBefore))(); refNode = utils.evaluateXPath(
insertBefore.replace(/^\s*xpath:\s*/i, ''),
tabContextMenu,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue;
} }
catch(e) { catch(e) {
} }