You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by vo...@apache.org on 2022/12/19 17:42:29 UTC

[myfaces] branch main updated: MYFACES-4514 -- follow up, do not write empty string for onchange

This is an automated email from the ASF dual-hosted git repository.

volosied pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/main by this push:
     new 3a3d966d9 MYFACES-4514 -- follow up, do not write empty string for onchange
     new 321817e81 Merge pull request #441 from volosied/MYFACES-4514
3a3d966d9 is described below

commit 3a3d966d9a3c8cf654f86e2ead3f11b86ddfe8ff
Author: Volodymyr Siedlecki <vo...@gmail.com>
AuthorDate: Mon Dec 19 11:44:04 2022 -0500

    MYFACES-4514 -- follow up, do not write empty string for onchange
---
 .../org/apache/myfaces/renderkit/html/util/HtmlRendererUtils.java  | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HtmlRendererUtils.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HtmlRendererUtils.java
index 9b429d265..2f6275632 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HtmlRendererUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HtmlRendererUtils.java
@@ -663,6 +663,13 @@ public final class HtmlRendererUtils
             String componentProperty, String attrName, Object value)
             throws IOException
     {
+
+        if(attrName.equals(HTML.ONCHANGE_ATTR) && value != null && value.toString().length() == 0)
+        {
+            // don't write onchange attribute if value is ""
+            return false; 
+        }
+
         if (!RendererUtils.isDefaultAttributeValue(value))
         {
             // render Faces "styleClass" and "itemStyleClass" attributes as "class"