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

Martin Grigorov commented on WICKET-4894:
-----------------------------------------

Hi,

I've experimented with this and it seems IE CSS engine doesn't check for 
dynamically injected links in conditional comments.
One solution is wicket-ajax.js to parse the condition before injectiing the 
element in the <head> and inject it only when necessary. But this doesn't look 
nice at all.

A much better solution is to check this at the server side:
 WebClientInfo clientInfo = (WebClientInfo) getSession().getClientInfo();
          ClientProperties properties = clientInfo.getProperties();
          if (properties.isBrowserInternetExplorer() && 
properties.getBrowserVersionMajor() >= 8)
          {
                  response.renderCSSReference(
                                  new PackageResourceReference( getClass(), 
"TestLabel-conditional.css" ));
          }

Nice and clean.
                
> Internet Explorer fails fails to properly include conditional stylesheet 
> links added via AjaxRequestTarget
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4894
>                 URL: https://issues.apache.org/jira/browse/WICKET-4894
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Jonas Pohlandt
>            Priority: Minor
>         Attachments: quickstart.zip
>
>
> CSS references added like this
>   @Override
>   public void renderHead( IHeaderResponse response ) {
>     super.renderHead( response );
>     response.renderCSSReference( 
>         new PackageResourceReference( getClass(), "TestLabel.css" ));
>     response.renderCSSReference( 
>         new PackageResourceReference( getClass(), "TestLabel-conditional.css" 
> ), null, null, "gte IE 8" );
>   }
> will not be taken into account by Internet Explorer (tested with 8 and 9) at 
> when rendering the document.
> I stepped though wicket-ajax.js and saw that the function added in 
> Wicket.Head.Contributor.processComment will actually be executed and a new 
> child node will be appended to the head node of the document. Unfortunately 
> it seems IE disregards conditional comments added in this way.
> I encountered this using Wicket 1.5.4.
> I'll upload a quickstart.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to