1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 00:07:58 +01:00

move the global isFormElemFocused() to Events

This commit is contained in:
Doug Kearns
2007-08-05 06:29:14 +00:00
parent f71a3c1722
commit 022e455d48
3 changed files with 27 additions and 34 deletions

View File

@@ -1320,35 +1320,6 @@ function scrollBufferAbsolute(horizontal, vertical)
win.scrollTo(horiz, vert); win.scrollTo(horiz, vert);
} }
/////////////////////////////////////////////////////////////////////}}}
// DOM related helper functions ////////////////////////////////////////
/////////////////////////////////////////////////////////////////////{{{
function isFormElemFocused()
{
var elt = window.document.commandDispatcher.focusedElement;
if (elt == null)
return false;
try
{ // sometimes the elt doesn't have .localName
var tagname = elt.localName.toLowerCase();
var type = elt.type.toLowerCase();
if ( (tagname == "input" && (type != "image")) ||
tagname == "textarea" ||
// tagName == "SELECT" ||
// tagName == "BUTTON" ||
tagname == "isindex") // isindex is a deprecated one-line input box
return true;
}
catch (e)
{
// FIXME: do nothing?
}
return false;
}
/////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////}}}
// misc helper functions /////////////////////////////////////////////// // misc helper functions ///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////{{{

View File

@@ -29,7 +29,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
function Events() //{{{ function Events() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// CONSTRUCTOR ///////////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
// this handler is for middle click only in the content // this handler is for middle click only in the content
@@ -76,9 +76,31 @@ function Events() //{{{
//alert("titlechanged"); //alert("titlechanged");
}, null); }, null);
/////////////////////////////////////////////////////////////////////////////}}} function isFormElemFocused()
////////////////////// PRIVATE SECTION ///////////////////////////////////////// {
/////////////////////////////////////////////////////////////////////////////{{{ var elt = window.document.commandDispatcher.focusedElement;
if (elt == null)
return false;
try
{ // sometimes the elt doesn't have .localName
var tagname = elt.localName.toLowerCase();
var type = elt.type.toLowerCase();
if ( (tagname == "input" && (type != "image")) ||
tagname == "textarea" ||
// tagName == "SELECT" ||
// tagName == "BUTTON" ||
tagname == "isindex") // isindex is a deprecated one-line input box
return true;
}
catch (e)
{
// FIXME: do nothing?
}
return false;
}
function onPageLoad(event) function onPageLoad(event)
{ {