Ok. Looking at the constants, the solution is probably to replace HTML.BODY_ATTRIBUTES with BODY_ATTRIBUTES_WITHOUT_EVENTS. I should have looked at the other available constants first.
On Mon, Feb 25, 2013 at 11:30 AM, Mike Kienenberger <[email protected]> wrote: > I've noticed this for some time in the MyFaces 2.1 code, but haven't > taken the time to look into it until recently. > > HtmlBodyRendererBase renders onload and onunload, but then renders it > a second time when isCommonPropertiesOptimizationEnabled() is true. > This is not the same issue as MYFACES-2630 where HTML.ONUNLOAD_ATTR > was misdefined as "onload". > > This appears to be because HTML.BODY_ATTRIBUTES contains onload and > onunload and these are unconditionally rendered a second time. > > I'm not sure what the solution should be. My guess is that we just > need to stop re-rendering the onload onunload attributes in the > optimized section. I'm not sure if we can change the contents of > BODY_ATTRIBUTES. It seems odd that passthrough attributes contains > more attributes than body attributes as replacing HTML.BODY_ATTRIBUTES > with HTML.BODY_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS was my first > though. > > HTML.BODY_ATTRIBUTES contains [onload, onunload, alink, vlink, link, > text, background, bgcolor] > HTML.BODY_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS contains [dir, lang, > title, style, styleClass, alink, vlink, link, text, background, > bgcolor] > > HtmlRendererUtils.renderBehaviorizedAttribute(facesContext, > writer, HTML.ONLOAD_ATTR, component, > ClientBehaviorEvents.LOAD, behaviors, HTML.ONLOAD_ATTR); > HtmlRendererUtils.renderBehaviorizedAttribute(facesContext, > writer, HTML.ONUNLOAD_ATTR, component, > ClientBehaviorEvents.UNLOAD, behaviors, > HTML.ONUNLOAD_ATTR); > > if (isCommonPropertiesOptimizationEnabled(facesContext)) > { > HtmlRendererUtils.renderHTMLAttributes(writer, component, > HTML.BODY_ATTRIBUTES); > > CommonPropertyUtils.renderCommonPassthroughPropertiesWithoutEvents(writer, > > CommonPropertyUtils.getCommonPropertiesMarked(component), component); > } > else > { > HtmlRendererUtils.renderHTMLAttributes(writer, component, > HTML.BODY_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS); > }
