myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: duplicate h:body onload (and probably onunload) attributes rendered when isCommonPropertiesOptimizationEnabled is true
Date Mon, 25 Feb 2013 16:45:56 GMT
Is trunk still 2.1?
I'm guessing I want to fix this on trunk, 2.0.x and 2.2.x


On Mon, Feb 25, 2013 at 11:39 AM, Leonardo Uribe <lu4242@gmail.com> wrote:
> Hi
>
> Yes, the solution seems correct.
>
> regards,
>
> Leonardo Uribe
>
> 2013/2/25 Mike Kienenberger <mkienenb@gmail.com>:
>> 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 <mkienenb@gmail.com> 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);
>>>             }

Mime
View raw message