bug 298892 redux. additional patch from neil, r=timeless, sr=dveditz, a=jay

This commit is contained in:
dveditz%cruzio.com 2005-07-06 17:42:07 +00:00
Родитель af7244a8a9
Коммит 6c5c70ee0b
2 изменённых файлов: 5 добавлений и 50 удалений

Просмотреть файл

@ -4748,7 +4748,8 @@ function asyncOpenWebPanel(event)
linkNode = target; linkNode = target;
} }
else { else {
linkNode = findParentNode(event.originalTarget, "a"); while (linkNode && !(linkNode instanceof HTMLAnchorElement))
linkNode = linkNode.parentNode;
// <a> cannot be nested. So if we find an anchor without an // <a> cannot be nested. So if we find an anchor without an
// href, there is no useful <a> around the target // href, there is no useful <a> around the target
if (linkNode && !linkNode.hasAttribute("href")) if (linkNode && !linkNode.hasAttribute("href"))
@ -4855,7 +4856,7 @@ function asyncOpenWebPanel(event)
} }
} }
if (event.button == 1 && if (event.button == 1 &&
!findParentNode(event.originalTarget, "scrollbar") && !event.getPreventDefault() &&
gPrefService.getBoolPref("middlemouse.contentLoadURL")) { gPrefService.getBoolPref("middlemouse.contentLoadURL")) {
middleMousePaste(event); middleMousePaste(event);
} }
@ -4940,29 +4941,6 @@ function makeURLAbsolute( base, url )
return ioService.newURI(baseURI.resolve(url), null, null).spec; return ioService.newURI(baseURI.resolve(url), null, null).spec;
} }
function findParentNode(node, parentNode)
{
if (node && node.nodeType == Node.TEXT_NODE) {
node = node.parentNode;
}
while (node) {
if (node.nodeType == Node.DOCUMENT_NODE) {
return null;
}
var nodeName = node.localName;
if (!nodeName)
return null;
nodeName = nodeName.toLowerCase();
if (nodeName == "body" || nodeName == "html") {
return null;
}
if (nodeName == parentNode)
return node;
node = node.parentNode;
}
return null;
}
/* /*
* Note that most of this routine has been moved into C++ in order to * Note that most of this routine has been moved into C++ in order to
* be available for all <browser> tags as well as gecko embedding. See * be available for all <browser> tags as well as gecko embedding. See

Просмотреть файл

@ -62,7 +62,8 @@
linkNode = target; linkNode = target;
} }
else if (!(target instanceof HTMLInputElement)) { else if (!(target instanceof HTMLInputElement)) {
linkNode = findParentNode(event.originalTarget, "a"); while (linkNode && !(linkNode instanceof HTMLAnchorElement))
linkNode = linkNode.parentNode;
// <a> cannot be nested. So if we find an anchor without an // <a> cannot be nested. So if we find an anchor without an
// href, there is no useful <a> around the target // href, there is no useful <a> around the target
if (linkNode && !linkNode.hasAttribute("href")) if (linkNode && !linkNode.hasAttribute("href"))
@ -119,27 +120,3 @@
return ioService.newURI(baseURI.resolve(url), null, null).spec; return ioService.newURI(baseURI.resolve(url), null, null).spec;
} }
function findParentNode(node, parentNode)
{
if (node && node.nodeType == Node.TEXT_NODE) {
node = node.parentNode;
}
while (node) {
var nodeName = node.localName;
if (!nodeName)
return null;
nodeName = nodeName.toLowerCase();
if (nodeName == "body" || nodeName == "html" ||
nodeName == "#document") {
return null;
}
if (nodeName == parentNode)
return node;
node = node.parentNode;
}
return null;
}