[ 
https://issues.apache.org/jira/browse/WICKET-6052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15065799#comment-15065799
 ] 

Sebastien Briquet commented on WICKET-6052:
-------------------------------------------

Hi, I need another opinion about the way to solve this...

h4. To sum-up
1/ The style's id is added by the HeadForceTagIdHandler markup filter:
MarkupParser: {{filters.add(new 
HeadForceTagIdHandler(containerInfo.getContainerClass()));}}

2/ The container-info actually holds the MarkupContainer class name (the final 
class), it is supplied to MarkupResourceStream through the 
DefaultMarkupResourceStreamProvider.
{{return new MarkupResourceStream(resourceStream, new ContainerInfo(container), 
containerClass);}}
Note that containerClass is the real class

h4. Some fix suggestions

a/ updating HeadForceTagIdHandler with a static counter, to obtain:
{code:html}
<style type="text/css" id="com-mycompany-panel-RedBox-0">
    .box {
        width: 150px;
        border: 2px solid black;
    }
</style>
<style type="text/css" id="com-mycompany-panel-RedBox-1">
    .red {
        background-color: red;
    }
</style>
{code}

Not very nice, impact is supposed to be the lowest but it breaks several tests: 
InheritanceHeadTest, HeaderScopingTest...

https://github.com/sebfz1/wicket/commit/fb7c5301e3b843ced22a20cf30e42230d925789c

b/ adding ContainerInfo (package visible?) ctor, to deal with the real class, 
and change call in DefaultMarkupResourceStreamProvider to obtain
{code:html}
<style type="text/css" id="com-mycompany-panel-AbstractBox-0">
    .box {
        width: 150px;
        border: 2px solid black;
    }
</style>
<style type="text/css" id="com-mycompany-panel-RedBox-0">
    .red {
        background-color: red;
    }
</style>
{code}

Medium impact, breaks one test: HeaderScopingTest
Question: should MarkupFactory be changed too?

https://github.com/sebfz1/wicket/commit/41fcfc4ea96e2c2d88752f929ce99572f5b615a8

c/ I also tried to update MarkupResourceStream ctor but it just breaks 
everything...
Just FYI, 
https://github.com/sebfz1/wicket/commit/cfaf97e889b48ec197c855388fc0d2908a57624d


WDYT?
Please Let me know if is there other ways to investigate...

Thanks in advance,
Sebastien.

> CSS header contribution overlap
> -------------------------------
>
>                 Key: WICKET-6052
>                 URL: https://issues.apache.org/jira/browse/WICKET-6052
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.1.0
>            Reporter: Sebastien Briquet
>            Assignee: Sebastien Briquet
>         Attachments: WICKET-6052.zip
>
>
> There is an overlap of css header contribution in the following case:
> A parent panel have a CSS HC (wicket:header + <style type="text/css">), a 
> child panel also have a CSS HC.
> If a child panel is completely newly added to the page via an ajax request, 
> then the child CSS HC is not taken into account. I guess it is because both 
> CSS HC share the same id...
> {code:html}
> <style type="text/css" id="com-mycompany-panel-RedBox-0">
>     .box {
>         width: 150px;
>         border: 2px solid black;
>     }
> </style>
> <style type="text/css" id="com-mycompany-panel-RedBox-0">
>     .red {
>         background-color: red;
>     }
> </style>
> {code}



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

Reply via email to