You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2012/07/03 00:46:50 UTC

svn commit: r1356512 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java

Author: bommel
Date: Mon Jul  2 22:46:50 2012
New Revision: 1356512

URL: http://svn.apache.org/viewvc?rev=1356512&view=rev
Log:
(TOBAGO-1168)
'"' and '\' are not escaped inside inputSuggest

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=1356512&r1=1356511&r2=1356512&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Mon Jul  2 22:46:50 2012
@@ -17,6 +17,7 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.UIIn;
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
@@ -189,11 +190,17 @@ public class InRenderer extends InputRen
       if (i > 0) {
         writer.write(", ");
       }
-      writer.write("{label: \"");
-      writer.write(suggestItem.getLabel());
-      writer.write("\", value: \"");
-      writer.write(suggestItem.getValue());
-      writer.write("\"");
+      writer.write("{label: '");
+      String label = suggestItem.getLabel();
+      label = StringUtils.replace(label, "\\", "\\\\");
+      label = StringUtils.replace(label, "\"", "\\\"");
+      writer.write(label);
+      writer.write("', value: '");
+      String value = suggestItem.getLabel();
+      value = StringUtils.replace(value, "\\", "\\\\");
+      value = StringUtils.replace(value, "\"", "\\\"");
+      writer.write(value);
+      writer.write("'");
       if (suggestItem.getExtensionItems() != null) {
         writer.write(", values: [");
         for (int j = 0; j < suggestItem.getExtensionItems().size(); j++) {
@@ -201,18 +208,18 @@ public class InRenderer extends InputRen
           if (j > 0) {
             writer.write(", ");
           }
-          writer.write("{id: \"");
+          writer.write("{id: '");
           writer.write(item.getId());
-          writer.write("\", value: \"");
+          writer.write("', value: '");
           writer.write(item.getValue());
-          writer.write("\"}");
+          writer.write("'}");
         }
         writer.write("]");
       }
       if (suggestItem.getNextFocusId() != null) {
-        writer.write(", nextFocusId: \"");
+        writer.write(", nextFocusId: '");
         writer.write(suggestItem.getNextFocusId());
-        writer.write("\"");
+        writer.write("'");
       }
 
       writer.write("}");