зеркало из https://github.com/mozilla/gecko-dev.git
Bug 298892 Use instanceof loop instead of findParentNode r=timeless sr+a=dveditz
This commit is contained in:
Родитель
f0a9c8b3fb
Коммит
bde71783c0
|
@ -134,7 +134,8 @@
|
||||||
prefillTextBox(target); // prefill the empty text field if possible
|
prefillTextBox(target); // prefill the empty text field if possible
|
||||||
}
|
}
|
||||||
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"))
|
||||||
|
@ -186,7 +187,6 @@
|
||||||
|
|
||||||
if (pref && !isKeyPress && event.button == 1 &&
|
if (pref && !isKeyPress && event.button == 1 &&
|
||||||
!event.getPreventDefault() &&
|
!event.getPreventDefault() &&
|
||||||
!findParentNode(event.originalTarget, "scrollbar") &&
|
|
||||||
pref.getBoolPref("middlemouse.contentLoadURL")) {
|
pref.getBoolPref("middlemouse.contentLoadURL")) {
|
||||||
if (middleMousePaste(event)) {
|
if (middleMousePaste(event)) {
|
||||||
event.preventBubble();
|
event.preventBubble();
|
||||||
|
|
|
@ -178,29 +178,6 @@ function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clientelle: (Make sure you don't break any of these)
|
// Clientelle: (Make sure you don't break any of these)
|
||||||
// - File -> Save Page/Frame As...
|
// - File -> Save Page/Frame As...
|
||||||
// - Context -> Save Page/Frame As...
|
// - Context -> Save Page/Frame As...
|
||||||
|
|
Загрузка…
Ссылка в новой задаче