[KSS-checkins] r40309 - in kukit/kukit.js/trunk: doc kukit

gotcha at codespeak.net gotcha at codespeak.net
Mon Mar 12 13:07:41 CET 2007


Author: gotcha
Date: Mon Mar 12 13:07:39 2007
New Revision: 40309

Modified:
   kukit/kukit.js/trunk/doc/CREDITS.txt
   kukit/kukit.js/trunk/kukit/dom.js
   kukit/kukit.js/trunk/kukit/forms.js
   kukit/kukit.js/trunk/kukit/oper.js
   kukit/kukit.js/trunk/kukit/plugin.js
Log:
add 'focus' action; credits

Modified: kukit/kukit.js/trunk/doc/CREDITS.txt
==============================================================================
--- kukit/kukit.js/trunk/doc/CREDITS.txt	(original)
+++ kukit/kukit.js/trunk/doc/CREDITS.txt	Mon Mar 12 13:07:39 2007
@@ -1,4 +1,5 @@
-Florian Schulze (florian.schulze at gmx.net)
 Godefroid Chapelle (gotcha at bubbblenet.be)
-Tarek Zyade (tziade at nuxeo.com)
+Tarek Ziade (ziade.tarek at gmail.com)
+Florian Schulze (florian.schulze at gmx.net)
 Balazs Ree (ree at greenfinity.hu)
+Jeroen Vloothuis (jeroen.vloothuis at xs4all.nl)

Modified: kukit/kukit.js/trunk/kukit/dom.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/dom.js	(original)
+++ kukit/kukit.js/trunk/kukit/dom.js	Mon Mar 12 13:07:39 2007
@@ -137,6 +137,16 @@
     return result;
 };
 
+kukit.dom.focus = function(node) {
+    tagName = node.tagName.toLowerCase();
+    if ((tagName == 'input') || (tagName == 'select') || (tagName == 'textarea')) {
+        node.focus();
+    }
+    else {
+        kukit.logWarning('Focus on node that cannot have focus !');
+    };
+}
+
 /*
 *  Gets the textual content of the node
 *  if recursive=false (default), does not descend into sub nodes

Modified: kukit/kukit.js/trunk/kukit/forms.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/forms.js	(original)
+++ kukit/kukit.js/trunk/kukit/forms.js	Mon Mar 12 13:07:39 2007
@@ -128,9 +128,6 @@
             if (value == "")
                 value = option.text;
         }
-    } else if (element.type == "checkbox") {
-        value = element.checked;
-
     } else if (typeof element.length != 'undefined' && typeof element.item != 'undefined' && element.item(0).type == "radio") {
         var radioList = element;
         value = null;
@@ -140,8 +137,7 @@
                 value = radio.value;
             }
         }
-    } else if (element.type == "radio") {
-    // for stupid people that use a single radio button
+    } else if (element.type == "radio" || element.type == "checkbox") {
         if (element.checked) {
            value = element.value;
         } else {

Modified: kukit/kukit.js/trunk/kukit/oper.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/oper.js	(original)
+++ kukit/kukit.js/trunk/kukit/oper.js	Mon Mar 12 13:07:39 2007
@@ -146,7 +146,7 @@
         }
     } else {
         // single node
-        kukit.logDebug('action Name: ' + name + ' executing on single target ' + nodetext(node));
+        kukit.logDebug('action Name: ' + name + ' executing on single target ' + nodetext(this.node));
         executeActions(this);
     }
 };

Modified: kukit/kukit.js/trunk/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/plugin.js	(original)
+++ kukit/kukit.js/trunk/kukit/plugin.js	Mon Mar 12 13:07:39 2007
@@ -569,6 +569,13 @@
 });
 kukit.commandsGlobalRegistry.registerFromAction('clearChildNodes', kukit.cr.makeSelectorCommand);
 
+kukit.actionsGlobalRegistry.register('focus', function(oper) {
+    // TODO get rid of none
+    oper.completeParms([], {'none': false}, 'focus action');
+    kukit.dom.focus(oper.node);
+});
+kukit.commandsGlobalRegistry.registerFromAction('focus', kukit.cr.makeSelectorCommand);
+
 kukit.actionsGlobalRegistry.register('moveNodeAfter', function(oper) {
     oper.completeParms(['html_id'], {}, 'moveNodeAfter action');
     var node = oper.node;


More information about the Kukit-checkins mailing list