summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/base/focus.js
diff options
context:
space:
mode:
authorwei <>2006-01-16 02:43:30 +0000
committerwei <>2006-01-16 02:43:30 +0000
commitca47a8c7fd5eb9f34ac00a2f1a843859d6123dd8 (patch)
tree436215c674c4ef68335bf9b3cfe1387236d762ff /framework/Web/Javascripts/base/focus.js
parent2d6584b56f0c52686f868c4c7dafc44db0f7c5cf (diff)
Diffstat (limited to 'framework/Web/Javascripts/base/focus.js')
-rw-r--r--framework/Web/Javascripts/base/focus.js99
1 files changed, 0 insertions, 99 deletions
diff --git a/framework/Web/Javascripts/base/focus.js b/framework/Web/Javascripts/base/focus.js
deleted file mode 100644
index 6c1359cd..00000000
--- a/framework/Web/Javascripts/base/focus.js
+++ /dev/null
@@ -1,99 +0,0 @@
-Prado.Focus = Class.create();
-
-Prado.Focus.setFocus = function(id)
-{
- var target = document.getElementById ? document.getElementById(id) : document.all[id];
- if(target && !Prado.Focus.canFocusOn(target))
- {
- target = Prado.Focus.findTarget(target);
- }
- if(target)
- {
- try
- {
- target.focus();
- target.scrollIntoView(false);
- if (window.__smartNav)
- {
- window.__smartNav.ae = target.id;
- }
- }
- catch (e)
- {
- }
- }
-}
-
-Prado.Focus.canFocusOn = function(element)
-{
- if(!element || !(element.tagName))
- return false;
- var tagName = element.tagName.toLowerCase();
- return !element.disabled && (!element.type || element.type.toLowerCase() != "hidden") && Prado.Focus.isFocusableTag(tagName) && Prado.Focus.isVisible(element);
-}
-
-Prado.Focus.isFocusableTag = function(tagName)
-{
- return (tagName == "input" || tagName == "textarea" || tagName == "select" || tagName == "button" || tagName == "a");
-}
-
-
-Prado.Focus.findTarget = function(element)
-{
- if(!element || !(element.tagName))
- {
- return null;
- }
- var tagName = element.tagName.toLowerCase();
- if (tagName == "undefined")
- {
- return null;
- }
- var children = element.childNodes;
- if (children)
- {
- for(var i=0;i<children.length;i++)
- {
- try
- {
- if(Prado.Focus.canFocusOn(children[i]))
- {
- return children[i];
- }
- else
- {
- var target = Prado.Focus.findTarget(children[i]);
- if(target)
- {
- return target;
- }
- }
- }
- catch (e)
- {
- }
- }
- }
- return null;
-}
-
-Prado.Focus.isVisible = function(element)
-{
- var current = element;
- while((typeof(current) != "undefined") && (current != null))
- {
- if(current.disabled || (typeof(current.style) != "undefined" && ((typeof(current.style.display) != "undefined" && current.style.display == "none") || (typeof(current.style.visibility) != "undefined" && current.style.visibility == "hidden") )))
- {
- return false;
- }
- if(typeof(current.parentNode) != "undefined" && current.parentNode != null && current.parentNode != current && current.parentNode.tagName.toLowerCase() != "body")
- {
- current = current.parentNode;
- }
- else
- {
- return true;
- }
- }
- return true;
-}