click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r961593 - /click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
Date Thu, 08 Jul 2010 06:41:19 GMT
Author: sabob
Date: Thu Jul  8 06:41:18 2010
New Revision: 961593

URL: http://svn.apache.org/viewvc?rev=961593&view=rev
Log:
use dash instead of underscore for CSS selector

Modified:
    click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java

Modified: click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java?rev=961593&r1=961592&r2=961593&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java Thu Jul  8 06:41:18
2010
@@ -1375,27 +1375,29 @@ public class ClickUtils {
      * <b>Please note:</b> it is highly recommended to set a control's ID
      * attribute when dealing with Ajax requests.
      * <p/>
-     * The algorith returns the selector in the following order:
+     * The CSS selector is calculated as follows:
      * <ol>
      *   <li>if control.getId() is set, prepend it with a '#' char
-     *   and return the value. An example selector will be: <tt>#field-id</tt></li>
-     *   <li>if control.getName() is not null the following checks are made:
+     *       and return the value. An example selector will be: <tt>#field-id</tt>
+     *   </li>
+     *
+     *   <li>if control.getName() is set do the following:
      *     <ol>
      *       <li>if the control is of type {@link org.apache.click.control.ActionLink},
-     *       its "<tt>class</tt>" attribute selector will be returned. For example:
-     *       <tt>input[class=red]</tt>.
-     *       <b>Please note:</b> if no class attribute is set, this method will
-     *       automatically set link's "class" attribute to its name value and
-     *       prefix the name with an underscore '_'. For example:
-     *       <tt>input[class=_my-link]</tt>.
+     *       it's "<tt>class</tt>" attribute selector will be returned. For example:
+     *       <tt>a[class=red]</tt>. <b>Please note:</b> if the link
class attribute is
+     *       not set, the class attribute will be set to its name, prefixed with
+     *       a dash, '-'. For example: <tt>a[class=-my-link]</tt>.
      *       </li>
+     *
      *       <li>if the control is not an ActionLink, it is assumed the control
      *       will render its "<tt>name</tt>" attribute and the name attribute
      *       selector will be returned. For example: <tt>input[name=my-button]</tt>.
      *       </li>
      *     </ol>
      *   </li>
-     *   <li>otherwise this method returns null.
+     *
+     *   <li>otherwise return null.
      *   </li>
      * </ol>
      *
@@ -1432,7 +1434,7 @@ public class ClickUtils {
             if (control instanceof ActionLink) {
                 ActionLink link = (ActionLink) control;
                 if (!link.hasAttribute("class")) {
-                    link.setAttribute("class", '_' + name);
+                    link.setAttribute("class", '-' + name);
                 }
                 buffer.append(tag).append("[class*=");
                 buffer.append(link.getAttribute("class")).append("]");



Mime
View raw message