You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jeanne Waldman (JIRA)" <de...@myfaces.apache.org> on 2008/08/15 01:11:45 UTC

[jira] Commented: (TRINIDAD-205) Need to avoid IE's number of CSS selectors limitation

    [ https://issues.apache.org/jira/browse/TRINIDAD-205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12622733#action_12622733 ] 

Jeanne Waldman commented on TRINIDAD-205:
-----------------------------------------

In a nutshell, the fix to this is to refactor out the file creating in
FileSystemStyleCache into an inner class that implements an interface that we
will create that will go in the same package as the CSSGenerationUtils. Then
instead of passing in the PrintWriter to writeCSS, we pass in an instance of
that interface that was created in FileSystemStyleCache, and this will have a
method to give us a PrintWriter. Then when we hit the limit in IE, we ask
that for another PrintWriter. The Interface will also have a method to give
us the name of all the files it had to create. In IE, that might be more than
one file. Otherwise it will be one file.
Then the FileSystemStyleCache's method that returns a URI will have to return
a List<String> instead of a String, and in StyleSheetRenderer, we'll render
all the uris, not just the one.

We need to double check that this will not break portal, but I don't think it
will. They look for all the stylesheets in the outer page, not just one.

We do have to make sure the caching still works correctly. I haven't thought
that part through too much yet. It should.

> Need to avoid IE's number of CSS selectors limitation
> -----------------------------------------------------
>
>                 Key: TRINIDAD-205
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-205
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 1.0.1-incubating-core-SNAPSHOT
>            Reporter: Jeanne Waldman
>
> it turns out that IE has a limit to the size of a CSS file. It's not the actual size of the file, but rather it is the
> # of CSS selectors. I did a test and found out that the limit is 4095 CSS selectors.
> Firefox doesn't appear to have a limit.
> As you may know, the CSS file we generate contains both compressed and uncompressed styles, like this:
> .af_inputText_content, .x01 {background-color: blue}
> Our renderers render a shortened styleclass, unless
> the DISABLE_CONTENT_COMPRESSION flag is set to true in web.xml, then it renders the long styleclass.
> <input class="x01...>
> Ok, that's the background.
> *The problem* is that because we have a lot of custom components that we've built on top of Trinidad, and our customers
> have built custom components, etc, and these all have skinning,
> we have bumped up against the 4095 selector limit in IE. All selectors after the 4095th one are ignored.
> *A quick fix*, and probably a good one for a long time, is to render the styles in compressed mode when compression is on,
> or in uncompressed mode when compression if off. That will reduce our style selectors by 1/2, and will help performance to boot. :)
> I can also add a warning if we go past 4095 selectors for IE.
> Another solution is to break up the file into multiple files when I've reached the limit in one file, and include
> all the css files into the rendered page. I can do this in addition to the quick fix when I have more time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.