15665 beta3+ Javascript selecting a link when dragging.

This commit is contained in:
mjudge%netscape.com 2000-08-02 22:07:00 +00:00
Родитель eee9dc1d76
Коммит 2882ccc967
2 изменённых файлов: 38 добавлений и 6 удалений

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

@ -1204,17 +1204,17 @@ function BrowserChangeTextSize(newSize)
{
var nodeName = node.nodeName;
if (nodeName == "")
return "";
return null;
nodeName = nodeName.toLowerCase();
if (nodeName == "" || nodeName == "body"
|| nodeName == "html" || nodeName == "#document")
return "";
return null;
var href = node.href;
if (nodeName == "a" && href != "")
return href;
return node;
node = node.parentNode;
}
return "";
return null;
}
function isScrollbar(node)
@ -1236,7 +1236,10 @@ function BrowserChangeTextSize(newSize)
var target = event.target;
if (pref.GetBoolPref("middlemouse.openNewWindow"))
{
var href = enclosingLink(target);
var node = enclosingLink(target);
var href ="";
if (node)
href = node.href;
if (href != "")
{
openNewWindowWith(href);

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

@ -216,9 +216,38 @@ var contentAreaDNDObserver = {
case 'LI':
case 'OL':
case 'DD':
textstring = enclosingLink(aEvent.target);
var node = enclosingLink(aEvent.target);
textstring = "";
//select node now!
if (node)
textstring = node.href;
if (textstring != "")
{
dump("link hit selecting link\n");
htmlstring = "<a href=\"" + textstring + "\">" + textstring + "</a>";
var parent = node.parentNode;
if (parent)
{
var nodelist = parent.childNodes;
var index;
for (index = 0; index<nodelist.length; index++)
{
if (nodelist.item(index) == node)
{
break;
}
}
if (index >= nodelist.length)
{
throw Components.results.NS_ERROR_FAILURE;
}
if (domselection)
{
domselection.collapse(parent,index);
domselection.extend(parent,index+1);
}
}
}
else
throw Components.results.NS_ERROR_FAILURE;
break;