You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by al...@apache.org on 2011/05/16 00:14:21 UTC

svn commit: r1103558 [2/3] - in /myfaces/html5/trunk: ./ myfaces-html5-core/ myfaces-html5-core/src/main/java/org/apache/myfaces/html5/component/input/ myfaces-html5-core/src/main/java/org/apache/myfaces/html5/component/util/ myfaces-html5-core/src/mai...

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/input/util/Html5EmailConverter.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/input/util/Html5EmailConverter.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/input/util/Html5EmailConverter.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/input/util/Html5EmailConverter.java Sun May 15 22:14:19 2011
@@ -25,7 +25,7 @@ import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 
 import org.apache.commons.validator.EmailValidator;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
+import org.apache.myfaces.html5.component.util.ComponentUtils;
 
 /**
  * Converter for use in hx:inputEmail.
@@ -54,7 +54,7 @@ public class Html5EmailConverter impleme
                 if (!EmailValidator.getInstance().isValid(email))
                 {
                     throw new ConverterException(new FacesMessage("Provided value for component "
-                            + RendererUtils.getPathToComponent(component) + " is not a valid email: " + email));
+                            + ComponentUtils.getPathToComponent(component) + " is not a valid email: " + email));
                 }
             }
 
@@ -93,7 +93,7 @@ public class Html5EmailConverter impleme
         else
         {
             throw new ConverterException(new FacesMessage("Provided value for component "
-                    + RendererUtils.getPathToComponent(component) + " is not String or String[]: " + value.toString()));
+                    + ComponentUtils.getPathToComponent(component) + " is not String or String[]: " + value.toString()));
         }
     }
 }

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AbstractMediaRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AbstractMediaRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AbstractMediaRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AbstractMediaRenderer.java Sun May 15 22:14:19 2011
@@ -31,14 +31,14 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
 
 import org.apache.myfaces.html5.component.media.AbstractMedia;
+import org.apache.myfaces.html5.component.util.ComponentUtils;
 import org.apache.myfaces.html5.model.MediaInfo;
 import org.apache.myfaces.html5.renderkit.util.HTML5;
 import org.apache.myfaces.html5.renderkit.util.Html5RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.JSFAttr;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.html5.renderkit.util.RendererUtils;
 
 /**
  * Abstract base for media renderers.
@@ -46,7 +46,7 @@ import org.apache.myfaces.shared_html5.r
  * @author Ali Ok
  * 
  */
-public abstract class AbstractMediaRenderer extends HtmlRenderer
+public abstract class AbstractMediaRenderer extends Renderer
 {
     private static final Logger log = Logger.getLogger(AbstractMediaRenderer.class.getName());
 
@@ -72,11 +72,11 @@ public abstract class AbstractMediaRende
         writer.writeAttribute(HTML5.ID_ATTR, component.getClientId(facesContext), null);
 
         // get the value and render the src attr
-        String src = org.apache.myfaces.shared_html5.renderkit.RendererUtils.getStringValue(facesContext, component);
+        String src = RendererUtils.getStringValue(facesContext, component);
         if (log.isLoggable(Level.FINE))
             log.fine("writing src '" + src + "'");
         if (src != null && !src.isEmpty())
-            writer.writeAttribute(HTML5.SRC_ATTR, src, JSFAttr.VALUE_ATTR);
+            writer.writeAttribute(HTML5.SRC_ATTR, src, "value");
 
         // no need to check the value of preload, it is bypassed anyway.
         // _checkPreload(component);
@@ -162,7 +162,7 @@ public abstract class AbstractMediaRende
                 // src is reqired to be present and not empty!
                 if (mediaInfo.getSrc() == null || mediaInfo.getSrc().isEmpty())
                     // WIKI: add a wiki page
-                    throw new FacesException("'src' field of MediaInfo has to be defined and nonempty for component " + RendererUtils.getPathToComponent(uiComponent) + ".");
+                    throw new FacesException("'src' field of MediaInfo has to be defined and nonempty for component " + ComponentUtils.getPathToComponent(uiComponent) + ".");
 
                 writer.writeAttribute(HTML5.SRC_ATTR, mediaInfo.getSrc(), null);
 

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AudioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AudioRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AudioRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/AudioRenderer.java Sun May 15 22:14:19 2011
@@ -29,7 +29,7 @@ import org.apache.myfaces.html5.componen
 import org.apache.myfaces.html5.renderkit.util.HTML5;
 import org.apache.myfaces.html5.renderkit.util.PassThroughAttributes;
 import org.apache.myfaces.html5.renderkit.util.PassThroughClientBehaviorEvents;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
+import org.apache.myfaces.html5.renderkit.util.RendererUtils;
 
 /**
  * Renderer for < hx:audio > component.

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/VideoRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/VideoRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/VideoRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/media/VideoRenderer.java Sun May 15 22:14:19 2011
@@ -29,7 +29,7 @@ import org.apache.myfaces.html5.componen
 import org.apache.myfaces.html5.renderkit.util.HTML5;
 import org.apache.myfaces.html5.renderkit.util.PassThroughAttributes;
 import org.apache.myfaces.html5.renderkit.util.PassThroughClientBehaviorEvents;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
+import org.apache.myfaces.html5.renderkit.util.RendererUtils;
 
 /**
  * Renderer for < hx:video > component.

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/MeterRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/MeterRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/MeterRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/MeterRenderer.java Sun May 15 22:14:19 2011
@@ -22,12 +22,7 @@ package org.apache.myfaces.html5.renderk
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 import org.apache.myfaces.html5.component.output.AbstractMeter;
 import org.apache.myfaces.html5.renderkit.panel.DivRenderer;
-import org.apache.myfaces.html5.renderkit.util.HTML5;
-import org.apache.myfaces.html5.renderkit.util.Html5RendererUtils;
-import org.apache.myfaces.html5.renderkit.util.PassThroughAttributes;
-import org.apache.myfaces.html5.renderkit.util.PassThroughClientBehaviorEvents;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.html5.renderkit.util.*;
 
 import javax.faces.FacesException;
 import javax.faces.component.UIComponent;
@@ -35,6 +30,7 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -42,7 +38,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 @JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.Meter", type = "org.apache.myfaces.html5.Meter")
-public class MeterRenderer extends HtmlRenderer
+public class MeterRenderer extends Renderer
 {
     private static final Logger log = Logger.getLogger(DivRenderer.class.getName());
 

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/ProgressRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/ProgressRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/ProgressRenderer.java Sun May 15 22:14:19 2011
@@ -3,12 +3,7 @@ package org.apache.myfaces.html5.renderk
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 import org.apache.myfaces.html5.component.output.AbstractProgress;
 import org.apache.myfaces.html5.renderkit.panel.DivRenderer;
-import org.apache.myfaces.html5.renderkit.util.HTML5;
-import org.apache.myfaces.html5.renderkit.util.Html5RendererUtils;
-import org.apache.myfaces.html5.renderkit.util.PassThroughAttributes;
-import org.apache.myfaces.html5.renderkit.util.PassThroughClientBehaviorEvents;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.html5.renderkit.util.*;
 
 import javax.faces.FacesException;
 import javax.faces.component.UIComponent;
@@ -16,6 +11,7 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -29,7 +25,7 @@ import java.util.logging.Logger;
  *
  */
 @JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.Progress", type = "org.apache.myfaces.html5.Progress")
-public class ProgressRenderer extends HtmlRenderer
+public class ProgressRenderer extends Renderer
 {
     private static final Logger log = Logger.getLogger(DivRenderer.class.getName());
 

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideRenderer.java Sun May 15 22:14:19 2011
@@ -22,10 +22,7 @@ package org.apache.myfaces.html5.renderk
 import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 import org.apache.myfaces.html5.component.output.AbstractSlide;
-import org.apache.myfaces.html5.component.output.AbstractSlideView;
 import org.apache.myfaces.html5.renderkit.util.*;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
 
 import javax.faces.application.ResourceDependencies;
 import javax.faces.application.ResourceDependency;
@@ -34,6 +31,7 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -47,7 +45,7 @@ import java.util.Map;
         @ResourceDependency(name = "html5.css", library = "org.apache.myfaces.html5", target = "head")
 })
 @JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.Slide", type = "org.apache.myfaces.html5.Slide")
-public class SlideRenderer extends HtmlRenderer
+public class SlideRenderer extends Renderer
 {
     @Override
     public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideViewRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideViewRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideViewRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/SlideViewRenderer.java Sun May 15 22:14:19 2011
@@ -23,8 +23,6 @@ import org.apache.commons.lang.StringUti
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 import org.apache.myfaces.html5.component.output.AbstractSlideView;
 import org.apache.myfaces.html5.renderkit.util.*;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
 
 import javax.faces.application.ResourceDependencies;
 import javax.faces.application.ResourceDependency;
@@ -33,6 +31,7 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
 import java.io.IOException;
 import java.text.MessageFormat;
 import java.util.List;
@@ -49,7 +48,7 @@ import static org.apache.myfaces.html5.r
         @ResourceDependency(name = "html5.css", library = "org.apache.myfaces.html5", target = "head")
 })
 @JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.SlideView", type = "org.apache.myfaces.html5.SlideView")
-public class SlideViewRenderer extends HtmlRenderer
+public class SlideViewRenderer extends Renderer
 {
     @Override
     public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/panel/DivRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/panel/DivRenderer.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/panel/DivRenderer.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/panel/DivRenderer.java Sun May 15 22:14:19 2011
@@ -29,16 +29,11 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 import org.apache.myfaces.html5.component.panel.AbstractDiv;
-import org.apache.myfaces.html5.renderkit.util.HTML5;
-import org.apache.myfaces.html5.renderkit.util.Html5RendererUtils;
-import org.apache.myfaces.html5.renderkit.util.PassThroughAttributes;
-import org.apache.myfaces.html5.renderkit.util.PassThroughClientBehaviorEvents;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
-import org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils;
+import org.apache.myfaces.html5.renderkit.util.*;
 
 /**
  * Div renderer.
@@ -47,7 +42,7 @@ import org.apache.myfaces.shared_impl.re
  * 
  */
 @JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.Div", type = "org.apache.myfaces.html5.Div")
-public class DivRenderer extends HtmlRenderer
+public class DivRenderer extends Renderer
 {
 
     private static final Logger log = Logger.getLogger(DivRenderer.class.getName());
@@ -112,7 +107,7 @@ public class DivRenderer extends HtmlRen
         // Check for npe
         super.decode(context, component);
 
-        HtmlRendererUtils.decodeClientBehaviors(context, component);
+        Html5RendererUtils.decodeClientBehaviors(context, component);
     }
 
 }

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ClientBehaviorEvents.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ClientBehaviorEvents.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ClientBehaviorEvents.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ClientBehaviorEvents.java Sun May 15 22:14:19 2011
@@ -73,6 +73,9 @@ public interface ClientBehaviorEvents
     String MOUSEOUT_EVENT = "mouseout";
     String MOUSEOVER_EVENT = "mouseover";
     String MOUSEUP_EVENT = "mouseup";
+    String CHANGE_EVENT = "change";
+    String SELECT_EVENT = "select";
+    String VALUECHANGE_EVENT= "valueChange";
 
     //Effect events
     String ANIMATIONEND_EVENT = "webkitAnimationEnd";

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/HTML5.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/HTML5.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/HTML5.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/HTML5.java Sun May 15 22:14:19 2011
@@ -19,15 +19,13 @@
 package org.apache.myfaces.html5.renderkit.util;
 
 /**
- * Html constants for using in renderers. Does not extend {@link org.apache.myfaces.shared_html5.renderkit.html.HTML} on
- * purpose, since there are ugly constants like
- * "COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK" in there. <br/>
- * Note that, this interface does not contain all of the element names and attribute names specified in Html5 spec. It
+ * Html constants for using in renderers. <br/>
+ * Note that, this interface does not contain all of the element names and attribute names specified in Html spec. It
  * only contains used ones in MyFaces Html5 components, and may not contain the attributes which have the same name with
  * the Jsf component property.
  * 
  * @author Ali Ok
- * @see org.apache.myfaces.shared_html5.renderkit.html.HTML
+ * @see org.apache.myfaces.commons.util.renderkit.HTML
  */
 public interface HTML5
 {
@@ -39,10 +37,12 @@ public interface HTML5
     String DATALIST_ELEM = "datalist";
 
     // html elements
+    String INPUT_ELEM = "input";
     String TEXTAREA_ELEM = "textarea";
     String DIV_ELEM = "div";
     String STYLE_ELEM = "style";
     String SCRIPT_ELEM = "script";
+    String OPTION_ELEM = "option";
 
     // general attrs
     String ID_ATTR = "id";
@@ -51,7 +51,13 @@ public interface HTML5
     String SRC_ATTR = "src";
     String TYPE_ATTR = "type";
     String CLASS_ATTR = "class";
+    String STYLE_ATTR = "style";
     String VALUE_ATTR = "value";
+    String DISABLED_ATTR = "disabled";
+    String LABEL_ATTR = "label";
+    String SCRIPT_TYPE_ATTR = "type";
+    String SCRIPT_TYPE_TEXT_JAVASCRIPT = "text/javascript";
+    String NAME_ATTR = "name";
 
     // media attrs
     String CONTROLS_ATTR = "controls"; // not pass thru
@@ -86,6 +92,7 @@ public interface HTML5
     String MIN_ATTR = "min";
     String MAX_ATTR = "max";
     String STEP_ATTR = "step";
+    String AUTOCOMPLETE_ATTR = "autocomplete";
 
     // new Html5 attributes which is boolean but not Html5 boolean
     // @see Html5RendererUtils#renderHTMLAttribute(javax.faces.context.ResponseWriter, String, String, Object)

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java Sun May 15 22:14:19 2011
@@ -18,35 +18,25 @@
  */
 package org.apache.myfaces.html5.renderkit.util;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.html5.component.util.ComponentUtils;
 
+import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
 import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.component.behavior.ClientBehaviorHint;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
-import javax.faces.convert.Converter;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.myfaces.html5.component.input.Html5BaseInputText;
-import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
-import org.apache.myfaces.shared_html5.renderkit.html.HtmlRendererUtils;
+import java.io.IOException;
+import java.util.*;
+import java.util.logging.Logger;
 
 /**
- * Renderer utils for common stuff.
- * <p>
- * Does not extend org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils on purpose, since this class should not
- * expose methods like
- * {@link org.apache.myfaces.shared_html5.renderkit.html.HtmlRendererUtils#renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(javax.faces.context.FacesContext, javax.faces.context.ResponseWriter, javax.faces.component.UIComponent, java.util.Map)}
- * 
  * @author Ali Ok
- * 
  */
 public class Html5RendererUtils
 {
@@ -58,6 +48,18 @@ public class Html5RendererUtils
 
     private static final String DEFAULT_WIDGET_PREFIX = "widget_";
 
+    private static final String LINE_SEPARATOR = System.getProperty("line.separator", "\r\n");
+    private static final char TABULATOR = '\t';
+
+    public static final String NON_SUBMITTED_VALUE_WARNING
+            = "There should always be a submitted value for an input if it is rendered,"
+            + " its form is submitted, and it was not originally rendered disabled or read-only."
+            + "  You cannot submit a form after disabling an input element via javascript."
+            + "  Consider setting read-only to true instead"
+            + " or resetting the disabled value back to false prior to form submission.";
+
+    private static final Logger log = Logger.getLogger(Html5RendererUtils.class.getName());
+
     /**
      * Renders the pass through attributes of the component. Value of the JSF properties will be written with the
      * matching Html attribute name.
@@ -149,12 +151,80 @@ public class Html5RendererUtils
             String eventName = passThroughClientBehaviors.get(property);
             String htmlAttrName = HTML_EVENT_ATTR_PREFIX + eventName;
 
-            org.apache.myfaces.shared_html5.renderkit.html.HtmlRendererUtils.renderBehaviorizedAttribute(facesContext,
+            renderBehaviorizedAttribute(facesContext,
                     facesContext.getResponseWriter(), property, uiComponent, eventName, clientBehaviors, htmlAttrName);
         }
 
     }
 
+    public static boolean renderBehaviorizedOnchangeEventHandler(
+            FacesContext facesContext, ResponseWriter writer, UIComponent uiComponent,
+            Map<String, List<ClientBehavior>> clientBehaviors) throws IOException {
+        boolean hasChange = Html5RendererUtils.hasClientBehavior(ClientBehaviorEvents.CHANGE_EVENT, clientBehaviors, facesContext);
+        boolean hasValueChange = Html5RendererUtils.hasClientBehavior(ClientBehaviorEvents.VALUECHANGE_EVENT, clientBehaviors, facesContext);
+
+        if (hasChange && hasValueChange) {
+            String chain = Html5RendererUtils.buildBehaviorChain(facesContext,
+                    uiComponent, ClientBehaviorEvents.CHANGE_EVENT, null, ClientBehaviorEvents.VALUECHANGE_EVENT, null, clientBehaviors,
+                    (String) uiComponent.getAttributes().get(JsfProperties.ONCHANGE_PROP), null);
+
+            return Html5RendererUtils.renderHTMLAttribute(writer, JsfProperties.ONCHANGE_PROP, JsfProperties.ONCHANGE_PROP, chain);
+        } else if (hasChange) {
+            return Html5RendererUtils.renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONCHANGE_PROP, uiComponent,
+                    ClientBehaviorEvents.CHANGE_EVENT, clientBehaviors, JsfProperties.ONCHANGE_PROP);
+        } else if (hasValueChange) {
+            return Html5RendererUtils.renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONCHANGE_PROP, uiComponent,
+                    ClientBehaviorEvents.VALUECHANGE_EVENT, clientBehaviors, JsfProperties.ONCHANGE_PROP);
+        } else {
+            return Html5RendererUtils.renderHTMLAttribute(writer, JsfProperties.ONCHANGE_PROP, JsfProperties.ONCHANGE_PROP, uiComponent.getAttributes().get(JsfProperties.ONCHANGE_PROP));
+        }
+    }
+
+    public static void renderBehaviorizedEventHandlers(
+            FacesContext facesContext, ResponseWriter writer, UIComponent uiComponent,
+            Map<String, List<ClientBehavior>> clientBehaviors) throws IOException {
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONCLICK_PROP, uiComponent,
+                ClientBehaviorEvents.CLICK_EVENT, clientBehaviors, JsfProperties.ONCLICK_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONDBLCLICK_PROP, uiComponent,
+                ClientBehaviorEvents.DBLCLICK_EVENT, clientBehaviors, JsfProperties.ONDBLCLICK_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONMOUSEDOWN_PROP, uiComponent,
+                ClientBehaviorEvents.MOUSEDOWN_EVENT, clientBehaviors, JsfProperties.ONMOUSEDOWN_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONMOUSEUP_PROP, uiComponent,
+                ClientBehaviorEvents.MOUSEUP_EVENT, clientBehaviors, JsfProperties.ONMOUSEUP_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONMOUSEOVER_PROP, uiComponent,
+                ClientBehaviorEvents.MOUSEOVER_EVENT, clientBehaviors, JsfProperties.ONMOUSEOVER_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONMOUSEMOVE_PROP, uiComponent,
+                ClientBehaviorEvents.MOUSEMOVE_EVENT, clientBehaviors, JsfProperties.ONMOUSEMOVE_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONMOUSEOUT_PROP, uiComponent,
+                ClientBehaviorEvents.MOUSEOUT_EVENT, clientBehaviors, JsfProperties.ONMOUSEOUT_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONKEYPRESS_PROP, uiComponent,
+                ClientBehaviorEvents.KEYPRESS_EVENT, clientBehaviors, JsfProperties.ONKEYPRESS_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONKEYDOWN_PROP, uiComponent,
+                ClientBehaviorEvents.KEYDOWN_EVENT, clientBehaviors, JsfProperties.ONKEYDOWN_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONKEYUP_PROP, uiComponent,
+                ClientBehaviorEvents.KEYUP_EVENT, clientBehaviors, JsfProperties.ONKEYUP_PROP);
+    }
+
+    public static void renderBehaviorizedFieldEventHandlersWithoutOnchange(
+            FacesContext facesContext, ResponseWriter writer, UIComponent uiComponent,
+            Map<String, List<ClientBehavior>> clientBehaviors) throws IOException {
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONFOCUS_PROP, uiComponent,
+                ClientBehaviorEvents.FOCUS_EVENT, clientBehaviors, JsfProperties.ONFOCUS_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONBLUR_PROP, uiComponent,
+                ClientBehaviorEvents.BLUR_EVENT, clientBehaviors, JsfProperties.ONBLUR_PROP);
+        renderBehaviorizedAttribute(facesContext, writer, JsfProperties.ONSELECT_PROP, uiComponent,
+                ClientBehaviorEvents.SELECT_EVENT, clientBehaviors, JsfProperties.ONSELECT_PROP);
+    }
+
+    public static boolean hasClientBehavior(String eventName,
+                                            Map<String, List<ClientBehavior>> behaviors,
+                                            FacesContext facesContext) {
+        if (behaviors == null) {
+            return false;
+        }
+        return (behaviors.get(eventName) != null);
+    }
+
     /**
      * Resolves string values from comma separated strings, string arrays or string collections.
      * 
@@ -239,19 +309,6 @@ public class Html5RendererUtils
     }
 
     /**
-     * Finds the converter of the component in a safe way.
-     * 
-     * @return null if no converter found or an exception occured inside
-     */
-    public static Converter findUIOutputConverterFailSafe(FacesContext facesContext, UIComponent component)
-    {
-        if(!(component instanceof UIOutput))
-            return null;
-        
-        return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component);
-    }
-
-    /**
      * Escapes the given string for use as a CSS selector.
      * @return Escaped selector
      */
@@ -281,4 +338,532 @@ public class Html5RendererUtils
 
         return str.replace(":", "_");
     }
+
+    /**
+     * @since 4.0.0
+     * @param facesContext
+     * @param component
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static void decodeClientBehaviors(FacesContext facesContext,
+            UIComponent component)
+    {
+        if (component instanceof ClientBehaviorHolder)
+        {
+            ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+
+            Map<String,List<ClientBehavior>> clientBehaviors =
+                clientBehaviorHolder.getClientBehaviors();
+
+            if (clientBehaviors != null && !clientBehaviors.isEmpty())
+            {
+                Map<String,String> paramMap = facesContext.getExternalContext().
+                    getRequestParameterMap();
+
+                String behaviorEventName = paramMap.get("javax.faces.behavior.event");
+
+                if (behaviorEventName != null)
+                {
+                    List<ClientBehavior> clientBehaviorList = clientBehaviors.get(behaviorEventName);
+
+                    if (clientBehaviorList != null && !clientBehaviorList.isEmpty())
+                    {
+                        String clientId = paramMap.get("javax.faces.source");
+
+                        if (component.getClientId().equals(clientId))
+                        {
+                            for (ClientBehavior clientBehavior : clientBehaviorList)
+                            {
+                                clientBehavior.decode(facesContext, component);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Render an attribute taking into account the passed event and
+     * the component property. The event will be rendered on the selected
+     * htmlAttrName
+     *
+     * @param facesContext
+     * @param writer
+     * @param component
+     * @param clientBehaviors
+     * @param eventName
+     * @param componentProperty
+     * @param htmlAttrName
+     * @return
+     * @throws IOException
+     * @since 4.0.1
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component,
+            String eventName, Map<String, List<ClientBehavior>> clientBehaviors,
+            String htmlAttrName) throws IOException {
+        return renderBehaviorizedAttribute(facesContext, writer,
+                componentProperty, component,
+                eventName, null, clientBehaviors,
+                htmlAttrName, (String) component.getAttributes().get(componentProperty));
+    }
+
+    /**
+     * Render an attribute taking into account the passed event,
+     * the component property and the passed attribute value for the component
+     * property. The event will be rendered on the selected htmlAttrName.
+     *
+     * @param facesContext
+     * @param writer
+     * @param componentProperty
+     * @param component
+     * @param eventName
+     * @param clientBehaviors
+     * @param htmlAttrName
+     * @param attributeValue
+     * @return
+     * @throws IOException
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component,
+            String eventName, Collection<ClientBehaviorContext.Parameter> eventParameters, Map<String, List<ClientBehavior>> clientBehaviors,
+            String htmlAttrName, String attributeValue) throws IOException {
+        List<ClientBehavior> cbl = (clientBehaviors != null) ? clientBehaviors.get(eventName) : null;
+
+        if (cbl == null || cbl.size() == 0) {
+            return renderHTMLAttribute(writer, componentProperty, htmlAttrName, attributeValue);
+        }
+
+        if (cbl.size() > 1 || (cbl.size() == 1 && attributeValue != null)) {
+            return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
+                    buildBehaviorChain(facesContext,
+                            component, eventName, eventParameters, clientBehaviors,
+                            attributeValue, StringUtils.EMPTY));
+        } else {
+            //Only 1 behavior and attrValue == null, so just render it directly
+            return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
+                    cbl.get(0).getScript(
+                            ClientBehaviorContext
+                                    .createClientBehaviorContext(facesContext, component,
+                                            eventName, component.getClientId(facesContext),
+                                            eventParameters)));
+        }
+    }
+
+    /**
+     * @param facesContext
+     * @param uiComponent
+     * @param clientBehaviors
+     * @param eventName
+     * @param userEventCode
+     * @param serverEventCode
+     * @param params
+     * @return
+     * @since 4.0.0
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    //modified
+    public static String buildBehaviorChain(FacesContext facesContext,
+                                            UIComponent uiComponent,
+                                            String eventName, Collection<ClientBehaviorContext.Parameter> params,
+                                            Map<String, List<ClientBehavior>> clientBehaviors,
+                                            String userEventCode, String serverEventCode) {
+        ExternalContext externalContext = facesContext.getExternalContext();
+        List<String> finalParams = new ArrayList<String>(3);
+        if(StringUtils.isNotBlank(userEventCode)){
+            // escape every ' in the user event code since it will
+            // be a string attribute of jsf.util.chain
+            finalParams.add('\'' + escapeJavaScriptForChain(userEventCode) + '\'');
+        }
+
+        ScriptContext behaviorCode = new ScriptContext();
+        ScriptContext retVal = new ScriptContext();
+
+        getClientBehaviorScript(facesContext, uiComponent, eventName, clientBehaviors,
+                behaviorCode, params);
+        if (behaviorCode!=null && StringUtils.isNotBlank(behaviorCode.toString())) {
+            finalParams.add(behaviorCode.toString());
+        }
+        if (StringUtils.isNotBlank(serverEventCode)) {
+            finalParams.add('\'' + escapeJavaScriptForChain(serverEventCode) + '\'');
+        }
+        Iterator<String> it = finalParams.iterator();
+
+        // It's possible that there are no behaviors to render.  For example, if we have
+        // <f:ajax disabled="true" /> as the only behavior.
+
+        if (it.hasNext()) {
+            //according to the spec jsf.util.chain has to be used to build up the behavior and scripts
+            retVal.append("jsf.util.chain(document.getElementById('"
+                    + uiComponent.getClientId(facesContext) + "'), event,");
+            while (it.hasNext()) {
+                retVal.append(it.next());
+                if (it.hasNext()) {
+                    retVal.append(", ");
+                }
+            }
+            retVal.append(");");
+        }
+
+        return retVal.toString();
+    }
+
+    public static String buildBehaviorChain(FacesContext facesContext,
+                                            UIComponent uiComponent,
+                                            String eventName1, Collection<ClientBehaviorContext.Parameter> params,
+                                            String eventName2, Collection<ClientBehaviorContext.Parameter> params2,
+                                            Map<String, List<ClientBehavior>> clientBehaviors,
+                                            String userEventCode,
+                                            String serverEventCode) {
+
+        List<String> finalParams = new ArrayList<String>(3);
+        if (StringUtils.isNotBlank(userEventCode)) {
+            finalParams.add('\'' + escapeJavaScriptForChain(userEventCode) + '\'');
+        }
+
+        ScriptContext behaviorCode = new ScriptContext();
+        ScriptContext retVal = new ScriptContext();
+
+        boolean submitting1 = getClientBehaviorScript(facesContext, uiComponent, eventName1, clientBehaviors,
+                behaviorCode, params);
+        boolean submitting2 = getClientBehaviorScript(facesContext, uiComponent, eventName2, clientBehaviors,
+                behaviorCode, params2);
+
+        // ClientBehaviors for both events have to be checked for the Submitting hint
+        boolean submitting = submitting1 || submitting2;
+
+        if (StringUtils.isNotBlank(behaviorCode.toString())) {
+            finalParams.add(behaviorCode.toString());
+        }
+        if (StringUtils.isNotBlank(serverEventCode)) {
+            finalParams.add('\'' + escapeJavaScriptForChain(serverEventCode) + '\'');
+        }
+        Iterator<String> it = finalParams.iterator();
+
+        // It's possible that there are no behaviors to render.  For example, if we have
+        // <f:ajax disabled="true" /> as the only behavior.
+
+        if (it.hasNext()) {
+            if (!submitting) {
+                retVal.append("return ");
+            }
+            //according to the spec jsf.util.chain has to be used to build up the behavior and scripts
+            retVal.append("jsf.util.chain(document.getElementById('"
+                    + uiComponent.getClientId(facesContext) + "'), event,");
+            while (it.hasNext()) {
+                retVal.append(it.next());
+                if (it.hasNext()) {
+                    retVal.append(", ");
+                }
+            }
+            retVal.append(");");
+            if (submitting) {
+                retVal.append(" return false;");
+            }
+        }
+
+        return retVal.toString();
+
+    }
+
+    /**
+     * builds the chained behavior script which then can be reused
+     * in following order by the other script building parts
+     * <p/>
+     * user defined event handling script
+     * behavior script
+     * renderer default script
+     *
+     * @param eventName    event name ("onclick" etc...)
+     * @param uiComponent  the component which has the attachement (or should have)
+     * @param facesContext the facesContext
+     * @param params       params map of params which have to be dragged into the request
+     * @return a string representation of the javascripts for the attached event behavior, an empty string if none is present
+     * @since 4.0.0
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    //modified
+    private static boolean getClientBehaviorScript(FacesContext facesContext,
+                                                   UIComponent uiComponent, String eventName,
+                                                   Map<String, List<ClientBehavior>> clientBehaviors,
+                                                   ScriptContext target, Collection<ClientBehaviorContext.Parameter> params) {
+        if (!(uiComponent instanceof ClientBehaviorHolder)) {
+            target.append(StringUtils.EMPTY);
+            return false;
+        }
+
+        ExternalContext externalContext = facesContext.getExternalContext();
+
+        boolean renderClientBehavior = MapUtils.isNotEmpty(clientBehaviors);
+        if (!renderClientBehavior) {
+            target.append(StringUtils.EMPTY);
+            return false;
+        }
+
+        List<ClientBehavior> attachedEventBehaviors = clientBehaviors
+                .get(eventName);
+        if (attachedEventBehaviors == null
+                || attachedEventBehaviors.size() == 0) {
+            target.append(StringUtils.EMPTY);
+            return false;
+        }
+
+        ClientBehaviorContext context = ClientBehaviorContext
+                .createClientBehaviorContext(facesContext, uiComponent,
+                        eventName, uiComponent.getClientId(facesContext),
+                        params);
+
+
+        boolean submitting = false;
+        Iterator<ClientBehavior> clientIterator = attachedEventBehaviors
+                .iterator();
+        while (clientIterator.hasNext()) {
+            ClientBehavior clientBehavior = clientIterator.next();
+            String script = clientBehavior.getScript(context);
+
+            // The script _can_ be null, and in fact is for <f:ajax disabled="true" />
+
+            if (script != null) {
+                //either strings or functions, but I assume string is more appropriate since it allows access to the
+                //origin as this!
+                target.append("'" + escapeJavaScriptForChain(script) + "'");
+                if (clientIterator.hasNext()) {
+                    target.append(", ");
+                }
+            }
+            if (!submitting) {
+                submitting = clientBehavior.getHints().contains(ClientBehaviorHint.SUBMITTING);
+            }
+        }
+        return submitting;
+    }
+
+    /**
+     * This function correctly escapes the given JavaScript code
+     * for the use in the jsf.util.chain() JavaScript function.
+     * It also handles double-escaping correclty.
+     *
+     * @param javaScript
+     * @return
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static String escapeJavaScriptForChain(String javaScript)
+    {
+        // first replace \' with \\'
+        //String escaped = StringUtils.replace(javaScript, "\\'", "\\\\'");
+
+        // then replace ' with \'
+        // (this will replace every \' in the original to \\\')
+        //escaped = StringUtils.replace(escaped, '\'', "\\'");
+
+        //return escaped;
+
+        StringBuffer out = null;
+        for (int pos = 0; pos < javaScript.length(); pos++)
+        {
+            char c = javaScript.charAt(pos);
+
+            if (c == '\\' || c == '\'')
+            {
+                if (out == null)
+                {
+                    out = new StringBuffer(javaScript.length() + 8);
+                    if (pos > 0)
+                    {
+                        out.append(javaScript, 0, pos);
+                    }
+                }
+                out.append('\\');
+            }
+            if (out != null)
+            {
+                out.append(c);
+            }
+        }
+
+        if (out == null)
+        {
+            return javaScript;
+        }
+        else
+        {
+            return out.toString();
+        }
+    }
+
+    /**
+     * Utility to set the submitted value of the provided component from the
+     * data in the current request object.
+     * <p/>
+     * Param component is required to be an EditableValueHolder. On return
+     * from this method, the component's submittedValue property will be
+     * set if the submitted form contained that component.
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static void decodeUIInput(FacesContext facesContext,
+                                     UIComponent component) {
+        if (!(component instanceof EditableValueHolder)) {
+            throw new IllegalArgumentException("Component "
+                    + component.getClientId(facesContext)
+                    + " is not an EditableValueHolder");
+        }
+        Map paramMap = facesContext.getExternalContext()
+                .getRequestParameterMap();
+        String clientId = component.getClientId(facesContext);
+
+        if (isDisabledOrReadOnly(component))
+            return;
+
+        if (paramMap.containsKey(clientId)) {
+            ((EditableValueHolder) component).setSubmittedValue(paramMap
+                    .get(clientId));
+        } else {
+            log.warning(NON_SUBMITTED_VALUE_WARNING +
+                    " Component : " +
+                    ComponentUtils.getPathToComponent(component));
+        }
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static boolean isDisabled(UIComponent component) {
+        return isTrue(component.getAttributes().get("disabled"));
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static boolean isReadOnly(UIComponent component) {
+        return isTrue(component.getAttributes().get("readonly"));
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    private static boolean isTrue(Object obj) {
+        if (obj instanceof String) {
+            return new Boolean((String) obj);
+        }
+
+        if (!(obj instanceof Boolean))
+            return false;
+
+        return ((Boolean) obj).booleanValue();
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    //modified
+    public static boolean isDisabledOrReadOnly(UIComponent component) {
+        return  isDisabled(component) ||
+                isReadOnly(component);
+    }
+
+    /**
+     * The ScriptContext offers methods and fields
+     * to help with rendering out a script and keeping a
+     * proper formatting.
+     */
+    //copied from org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils
+    public static class ScriptContext {
+        private long currentIndentationLevel;
+        private StringBuffer buffer = new StringBuffer();
+        private boolean prettyPrint = false;
+        /**
+         * automatic formatting will render
+         * new-lines and indents if blocks are opened
+         * and closed - attention: you need to append
+         * opening and closing brackets of blocks separately in this case!
+         */
+        private boolean automaticFormatting = true;
+
+        public ScriptContext() {
+
+        }
+
+        public ScriptContext(boolean prettyPrint) {
+            this.prettyPrint = prettyPrint;
+        }
+
+        public ScriptContext(StringBuffer buf, boolean prettyPrint) {
+            this.prettyPrint = prettyPrint;
+            this.buffer = buf;
+        }
+
+        public void increaseIndent() {
+            currentIndentationLevel++;
+        }
+
+        public void decreaseIndent() {
+            currentIndentationLevel--;
+
+            if (currentIndentationLevel < 0)
+                currentIndentationLevel = 0;
+        }
+
+        public void prettyLine() {
+            if (prettyPrint) {
+                append(LINE_SEPARATOR);
+
+                for (int i = 0; i < getCurrentIndentationLevel(); i++)
+                    append(TABULATOR);
+            }
+        }
+
+        public void prettyLineIncreaseIndent() {
+            increaseIndent();
+            prettyLine();
+        }
+
+        public void prettyLineDecreaseIndent() {
+            decreaseIndent();
+            prettyLine();
+        }
+
+        public long getCurrentIndentationLevel() {
+            return currentIndentationLevel;
+        }
+
+        public void setCurrentIndentationLevel(long currentIndentationLevel) {
+            this.currentIndentationLevel = currentIndentationLevel;
+        }
+
+        public ScriptContext append(String str) {
+
+            if (automaticFormatting && str.length() == 1) {
+                boolean openBlock = str.equals("{");
+                boolean closeBlock = str.equals("}");
+
+                if (openBlock) {
+                    prettyLine();
+                } else if (closeBlock) {
+                    prettyLineDecreaseIndent();
+                }
+
+                buffer.append(str);
+
+                if (openBlock) {
+                    prettyLineIncreaseIndent();
+                } else if (closeBlock) {
+                    prettyLine();
+                }
+            } else {
+                buffer.append(str);
+            }
+            return this;
+        }
+
+        public ScriptContext append(char c) {
+            buffer.append(c);
+            return this;
+        }
+
+        public ScriptContext append(int i) {
+            buffer.append(i);
+            return this;
+        }
+
+        public String toString() {
+            return buffer.toString();
+        }
+    }
 }

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/JsfProperties.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/JsfProperties.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/JsfProperties.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/JsfProperties.java Sun May 15 22:14:19 2011
@@ -40,8 +40,12 @@ public interface JsfProperties
     String SRC_PROP = "src";
     String WIDTH_PROP = "width";
     String HEIGHT_PROP = "height";
+    String ALIGN_PROP = "align";
+    String ALT_PROP = "alt";
+    String SIZE_PROP = "size";
 
     String VALUE_PROP = "value";
+    String VAR_PROP = "var";
 
     // new Html5 common props
     String HIDDEN_PROP = "hidden";
@@ -111,10 +115,20 @@ public interface JsfProperties
     String MAXLENGTH_PROP = "maxlength";
     String READONLY_PROP = "readonly";
     String STEP_PROP = "step";
+    String ONCHANGE_PROP = "onchange";
+    String ONSELECT_PROP = "onselect";
 
     // input email props
     String MULTIPLE_PROP = "multiple";
 
+    //textarea props
+    String COLS_PROP = "cols";
+    String ROWS_PROP = "rows";
+    String WRAP_PROP = "wrap";
+
+    // Input_Secret Attributes
+    String REDISPLAY_PROP = "redisplay";
+
     // possible types for hx:inputText
     String INPUTTEXT_TYPE_PASSWORD = "password";
     String INPUTTEXT_TYPE_TEXTAREA = "textarea";
@@ -139,4 +153,14 @@ public interface JsfProperties
     String HIGH_PROP = "high";
 
     String ONANIMATIONEND_PROP = "onanimationEnd";
+
+
+    // UISelectItem(s) attributes
+    String ITEM_DISABLED_PROP          = "itemDisabled";
+    String ITEM_DESCRIPTION_PROP       = "itemDescription";
+    String ITEM_LABEL_PROP             = "itemLabel";
+    String ITEM_VALUE_PROP             = "itemValue";
+    String ITEM_LABEL_ESCAPED_PROP     = "itemLabelEscaped";
+    String NO_SELECTION_VALUE_PROP     = "noSelectionValue";
+
 }

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributeGroups.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributeGroups.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributeGroups.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributeGroups.java Sun May 15 22:14:19 2011
@@ -42,11 +42,27 @@ interface PassThroughAttributeGroups {
         .attr(ACCESSKEY_PROP)
         .attr(TABINDEX_PROP)
         .unmodifiable();
-    
+
     Map<String, String> DND_PROPS = map(1)
         .attr(DRAGGABLE_PROP)
         .unmodifiable();
-    
+
+    Map<String, String> COMMON_INPUT_PROPS = map(13)
+        .attr(ALIGN_PROP)
+        .attr(ALT_PROP)
+        .attr(MAXLENGTH_PROP)
+        .attr(READONLY_PROP)
+        .attr(SIZE_PROP)
+        .attr(STYLE_PROP, STYLE_ATTR)
+        .attr(STYLECLASS_PROP, CLASS_ATTR)
+        .attr(DIR_PROP)
+        .attr(LANG_PROP)
+        .attr(TITLE_PROP)
+        .attr(ACCESSKEY_PROP)
+        .attr(TABINDEX_PROP)
+        .attr(DISABLED_ATTR)
+        .unmodifiable();
+
     Map<String, String> HTML5_INPUT_PROPS = map(2)
         .attr(DATALIST_PROP, LIST_ATTR)
         .attr(AUTOFOCUS_PROP)

Modified: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributes.java?rev=1103558&r1=1103557&r2=1103558&view=diff
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributes.java (original)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/PassThroughAttributes.java Sun May 15 22:14:19 2011
@@ -21,7 +21,6 @@ package org.apache.myfaces.html5.renderk
 import static org.apache.myfaces.html5.renderkit.util.AttributeMap.map;
 import static org.apache.myfaces.html5.renderkit.util.HTML5.*;
 import static org.apache.myfaces.html5.renderkit.util.JsfProperties.*;
-import org.apache.myfaces.html5.renderkit.util.PassThroughAttributeGroups;
 
 import java.util.Map;
 
@@ -49,6 +48,10 @@ public interface PassThroughAttributes
         .attr(HEIGHT_PROP)
         .unmodifiable();
 
+    Map<String, String> BASE_INPUT = map(13)
+        .attrs(PassThroughAttributeGroups.COMMON_INPUT_PROPS)
+        .unmodifiable();
+
     Map<String, String> INPUT_COLOR = map(4)
         .attrs(PassThroughAttributeGroups.HTML5_GLOBAL_PROPS)
         .attrs(PassThroughAttributeGroups.HTML5_INPUT_PROPS)
@@ -72,7 +75,9 @@ public interface PassThroughAttributes
         .attrs(PassThroughAttributeGroups.HTML5_GLOBAL_PROPS)
         .attr(AUTOFOCUS_PROP)
         .attr(REQUIRED_PROP)
-        .attr(MAXLENGTH_PROP)
+        .attr(COLS_PROP)
+        .attr(ROWS_PROP)
+        .attr(WRAP_PROP)
         .unmodifiable();
 
     Map<String, String> INPUT_EMAIL = map(7)
@@ -134,5 +139,5 @@ public interface PassThroughAttributes
         .attrs(PassThroughAttributeGroups.HTML5_GLOBAL_PROPS)
         .attrs(PassThroughAttributeGroups.HTML_GLOBAL_PROPS)
         .unmodifiable();
-    
+
 }

Added: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/RendererUtils.java?rev=1103558&view=auto
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/RendererUtils.java (added)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/RendererUtils.java Sun May 15 22:14:19 2011
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.html5.renderkit.util;
+
+import org.apache.myfaces.html5.component.util.ComponentUtils;
+
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.el.PropertyNotFoundException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Ali Ok
+ */
+public class RendererUtils {
+
+    //copied from org.apache.myfaces.shared.renderkit.RendererUtils
+    public static void checkParamValidity(FacesContext facesContext, UIComponent uiComponent, Class compClass)
+    {
+        if(facesContext == null)
+            throw new NullPointerException("facesContext may not be null");
+        if(uiComponent == null)
+            throw new NullPointerException("uiComponent may not be null");
+
+        //if (compClass != null && !(compClass.isAssignableFrom(uiComponent.getClass())))
+        // why isAssignableFrom with additional getClass method call if isInstance does the same?
+        if (compClass != null && !(compClass.isInstance(uiComponent)))
+        {
+            throw new IllegalArgumentException("uiComponent : " + ComponentUtils.getPathToComponent(uiComponent)+
+                    " is not instance of "+compClass.getName()+" as it should be");
+        }
+    }
+
+    /**
+     * Convenient utility method that returns the currently given value as String,
+     * using the given converter.
+     * Especially usefull for dealing with primitive types.
+     */
+    //copied from org.apache.myfaces.shared.renderkit.RendererUtils
+    public static String getConvertedStringValue(FacesContext context,
+            UIComponent component, Converter converter, Object value) {
+        if (converter == null) {
+            if (value == null) {
+                return "";
+            } else if (value instanceof String) {
+                return (String) value;
+            } else {
+                return value.toString();
+            }
+        }
+
+        return converter.getAsString(context, component, value);
+    }
+
+    /**
+     * Find the proper Converter for the given UIOutput component.
+     * @return the Converter or null if no Converter specified or needed
+     * @throws javax.faces.FacesException if the Converter could not be created
+     */
+    //copied from org.apache.myfaces.shared.renderkit.RendererUtils
+    public static Converter findUIOutputConverter(FacesContext facesContext,
+                                                  UIOutput component)
+            throws FacesException
+    {
+        // Attention!
+        // This code is duplicated in jsfapi component package.
+        // If you change something here please do the same in the other class!
+
+        Converter converter = component.getConverter();
+        if (converter != null)
+            return converter;
+
+        //Try to find out by value expression
+        ValueExpression expression = component.getValueExpression("value");
+        if (expression == null)
+            return null;
+
+        Class valueType = expression.getType(facesContext.getELContext());
+        if (valueType == null)
+            return null;
+
+        if (Object.class.equals(valueType))
+            return null; //There is no converter for Object class
+
+        try
+        {
+            return facesContext.getApplication().createConverter(valueType);
+        }
+        catch (FacesException e)
+        {
+            log(facesContext, "No Converter for type " + valueType.getName()
+                    + " found", e);
+            return null;
+        }
+    }
+
+    /**
+     * Finds the converter of the component in a safe way.
+     *
+     * @return null if no converter found or an exception occured inside
+     */
+    //copied from org.apache.myfaces.shared.renderkit.RendererUtils
+    public static Converter findUIOutputConverterFailSafe(FacesContext facesContext, UIComponent uiComponent) {
+        Converter converter;
+        try {
+            converter = RendererUtils.findUIOutputConverter(facesContext,
+                    (UIOutput) uiComponent);
+        } catch (FacesException e) {
+            log.log(Level.SEVERE, "Error finding Converter for component with id "
+                    + uiComponent.getClientId(facesContext), e);
+            converter = null;
+        }
+        return converter;
+    }
+
+    /**
+     * See JSF Spec. 8.5 Table 8-1
+     * @param value
+     * @return boolean
+     */
+    //copied from org.apache.myfaces.shared.renderkit.RendererUtils
+    public static boolean isDefaultAttributeValue(Object value)
+    {
+        if (value == null)
+        {
+            return true;
+        }
+        else if (value instanceof Boolean)
+        {
+            return !((Boolean) value).booleanValue();
+        }
+        else if (value instanceof Number)
+        {
+            if (value instanceof Integer)
+            {
+                return ((Number)value).intValue() == Integer.MIN_VALUE;
+            }
+            else if (value instanceof Double)
+            {
+                return ((Number)value).doubleValue() == Double.MIN_VALUE;
+            }
+            else if (value instanceof Long)
+            {
+                return ((Number)value).longValue() == Long.MIN_VALUE;
+            }
+            else if (value instanceof Byte)
+            {
+                return ((Number)value).byteValue() == Byte.MIN_VALUE;
+            }
+            else if (value instanceof Float)
+            {
+                return ((Number)value).floatValue() == Float.MIN_VALUE;
+            }
+            else if (value instanceof Short)
+            {
+                return ((Number)value).shortValue() == Short.MIN_VALUE;
+            }
+        }
+        return false;
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit._SharedRendererUtils
+    private static final Logger log = Logger.getLogger(RendererUtils.class.getName());
+    private static void log(FacesContext context, String msg, Exception e)
+    {
+        log.log(Level.SEVERE, msg, e);
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.RendererUtils
+    public static String getStringValue(FacesContext facesContext,
+                                        UIComponent component)
+    {
+        try
+        {
+            if (!(component instanceof ValueHolder))
+            {
+                throw new IllegalArgumentException("Component : " + ComponentUtils.getPathToComponent(component)+"is not a ValueHolder");
+            }
+
+            if (component instanceof EditableValueHolder)
+            {
+                Object submittedValue = ((EditableValueHolder)component).getSubmittedValue();
+                if (submittedValue != null)
+                {
+                        if (log.isLoggable(Level.FINE)) log.fine("returning 1 '" + submittedValue + "'");
+                        return submittedValue.toString();
+                }
+            }
+
+            Object value;
+
+            if(component instanceof EditableValueHolder) {
+
+                EditableValueHolder holder = (EditableValueHolder) component;
+
+                if(holder.isLocalValueSet()) {
+                    value = holder.getLocalValue();
+                } else {
+                    value = getValue(component);
+                }
+            }
+            else {
+                value = getValue(component);
+            }
+
+            Converter converter = ((ValueHolder)component).getConverter();
+            if (converter == null  && value != null)
+            {
+
+                try
+                {
+                    converter = facesContext.getApplication().createConverter(value.getClass());
+                    if (log.isLoggable(Level.FINE)) log.fine("the created converter is " + converter);
+                }
+                catch (FacesException e)
+                {
+                    log.log(Level.SEVERE, "No converter for class " + value.getClass().getName() + " found (component id=" + component.getId() + ").", e);
+                    // converter stays null
+                }
+            }
+
+            if (converter == null)
+            {
+                if (value == null)
+                {
+                    if (log.isLoggable(Level.FINE)) log.fine("returning an empty string");
+                    return "";
+                }
+
+                if (log.isLoggable(Level.FINE)) log.fine("returning an .toString");
+                return value.toString();
+
+            }
+
+            if (log.isLoggable(Level.FINE)) log.fine("returning converter get as string " + converter);
+            return converter.getAsString(facesContext, component, value);
+
+        }
+        catch(PropertyNotFoundException ex)
+        {
+            log.log(Level.SEVERE, "Property not found - called by component : "+ComponentUtils.getPathToComponent(component),ex);
+
+            throw ex;
+        }
+    }
+
+    private static Object getValue(UIComponent component) {
+        Object value;
+        try
+        {
+            value = ((ValueHolder) component).getValue();
+        }
+        catch(Exception ex)
+        {
+            throw new FacesException("Could not retrieve value of component with path : "+
+                    ComponentUtils.getPathToComponent(component),ex);
+        }
+        return value;
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.RendererUtils
+    public static Object getConvertedUIOutputValue(FacesContext facesContext, UIOutput output, Object submittedValue)
+            throws ConverterException
+    {
+        if (submittedValue != null && !(submittedValue instanceof String))
+        {
+            submittedValue = submittedValue.toString();
+        }
+
+        Converter converter;
+        try
+        {
+            converter = findUIOutputConverter(facesContext, output);
+        }
+        catch (FacesException e)
+        {
+            throw new ConverterException(e);
+        }
+
+        return converter == null ? submittedValue : converter
+                .getAsObject(facesContext, output, (String) submittedValue);
+    }
+}

Added: myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ResourceUtils.java
URL: http://svn.apache.org/viewvc/myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ResourceUtils.java?rev=1103558&view=auto
==============================================================================
--- myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ResourceUtils.java (added)
+++ myfaces/html5/trunk/myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/ResourceUtils.java Sun May 15 22:14:19 2011
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.html5.renderkit.util;
+
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ResourceUtils {
+
+    private final static String RENDERED_JSF_JS = "org.apache.myfaces.RENDERED_JSF_JS";
+
+    public final static String JAVAX_FACES_LIBRARY_NAME = "javax.faces";
+    public final static String JSF_JS_RESOURCE_NAME = "jsf.js";
+
+    private final static String RENDERED_SCRIPT_RESOURCES_SET = "org.apache.myfaces.RENDERED_SCRIPT_RESOURCES_SET";
+
+    //copied from org.apache.myfaces.shared.renderkit.html.util.ResourceUtils
+    //modified
+    public static void renderDefaultJsfJsInlineIfNecessary(FacesContext facesContext, ResponseWriter writer) throws IOException
+    {
+        if (facesContext.getAttributes().containsKey(RENDERED_JSF_JS))
+        {
+            return;
+        }
+
+        // Check first if we have lucky, we are using myfaces and the script has
+        // been previously rendered
+        if (isRenderedScript(facesContext, JAVAX_FACES_LIBRARY_NAME, JSF_JS_RESOURCE_NAME))
+        {
+            facesContext.getAttributes().put(RENDERED_JSF_JS, Boolean.TRUE);
+            return;
+        }
+
+        // Check if this is an ajax request. If so, we don't need to include it, because that was
+        // already done and in the worst case, jsf script was already loaded on the page.
+        if (facesContext.getPartialViewContext() != null && facesContext.getPartialViewContext().isAjaxRequest())
+        {
+            return;
+        }
+
+        //Fast shortcut, don't create component instance and do what HtmlScriptRenderer do.
+        Resource resource = facesContext.getApplication().getResourceHandler().createResource(JSF_JS_RESOURCE_NAME, JAVAX_FACES_LIBRARY_NAME);
+        markScriptAsRendered(facesContext, JAVAX_FACES_LIBRARY_NAME, JSF_JS_RESOURCE_NAME);
+        writer.startElement(HTML5.SCRIPT_ELEM, null);
+        writer.writeAttribute(HTML5.SCRIPT_TYPE_ATTR, HTML5.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
+        writer.writeURIAttribute(HTML5.SRC_ATTR, resource.getRequestPath(), null);
+        writer.endElement(HTML5.SCRIPT_ELEM);
+
+        //mark as rendered
+        facesContext.getAttributes().put(RENDERED_JSF_JS, Boolean.TRUE);
+        return;
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.html.util.ResourceUtils
+    public static boolean isRenderedScript(FacesContext facesContext, String libraryName, String resourceName)
+    {
+        return getRenderedScriptResources(facesContext).containsKey(libraryName != null ? libraryName+'/'+resourceName : resourceName);
+    }
+
+    /**
+     * Return a set of already rendered resources by this renderer on the current
+     * request.
+     *
+     * @param facesContext
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    //copied from org.apache.myfaces.shared.renderkit.html.util.ResourceUtils
+    private static Map<String, Boolean> getRenderedScriptResources(FacesContext facesContext)
+    {
+        Map<String, Boolean> map = (Map<String, Boolean>) facesContext.getAttributes().get(RENDERED_SCRIPT_RESOURCES_SET);
+        if (map == null)
+        {
+            map = new HashMap<String, Boolean>();
+            facesContext.getAttributes().put(RENDERED_SCRIPT_RESOURCES_SET,map);
+        }
+        return map;
+    }
+
+    //copied from org.apache.myfaces.shared.renderkit.html.util.ResourceUtils
+    public static void markScriptAsRendered(FacesContext facesContext, String libraryName, String resourceName)
+    {
+        getRenderedScriptResources(facesContext).put(libraryName != null ? libraryName+'/'+resourceName : resourceName, Boolean.TRUE);
+    }
+}