I D created TAP5-2507:
-------------------------

             Summary: When Zone is used within head element, it moves elements 
from head to body element
                 Key: TAP5-2507
                 URL: https://issues.apache.org/jira/browse/TAP5-2507
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.4
            Reporter: I D
            Priority: Minor


In our project we tried to surround the <title> element with a <t:zone>, in 
order to be able to refresh it via ajax.

For a while, this seemed to work. However, a strange bug led us to discover 
what this caused behind the scenes: the <title> element, as well as all the 
<link> elements importing stylesheets (?!), were now being rendered as children 
of the <body> element instead of as children of the <head> element. This 
happened not only following a refresh of this zone, but even on initial render.

The fact that the CSS links were moved by tapestry (not clear why - the zone 
only contained the title tag) was surprisingly well handled by browser (I never 
guessed that <title> and <link> elements would be "respected" by the browser 
even when they are in the document body rather than its head), but it had at 
least one annoying side-effect - the page began to render before the CSS was 
applied, which resulted in a strange flicker immediately following page load.

We now realize that Zone cannot / should not be used within the head element, 
but the way we discovered this was too roundabout. I think the reasonable 
behavior should be either of the following:

- Prevent Zone from being used inside the <head> element by throwing an 
appropriate exception on page load (this should also be stated in the 
documentation for the Zone component)

or

- Allow Zone to be used inside the <head> element, but don't move elements 
around the DOM tree - keep whatever's in the <head> element within the <head> 
element.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to