[jboss-jira] [JBoss JIRA] Commented: (JBPORTAL-1631) Allow different stylesheets for different user-agents
Andy Pemberton (JIRA)
jira-events at lists.jboss.org
Thu Aug 16 11:41:01 EDT 2007
[ http://jira.jboss.com/jira/browse/JBPORTAL-1631?page=comments#action_12372553 ]
Andy Pemberton commented on JBPORTAL-1631:
------------------------------------------
Thomas:
First, I want to mention that I really enjoy JBoss Portal and appreciate all the hard work by you and your team. My company is actively and successfully using JBoss Portal on several client projects. Because I enjoy the product, I have a vested interest in its success in the market.
So - back to the discussion at hand: while I do see some value in targeting CSS to specific user-agents, I also see problems with this approach.
(a) Typically, this approach relies on the user-agent string from a HTTP header. The problem with this approach is that the user-agent string can be changed and is done so quite frequently. In short, the user-agent string is not a reliable indicator of the client's browser (see: https://addons.mozilla.org/en-US/firefox/addon/59).
(b) A bigger problem, however, is that targeting CSS to particular user agents creates maintainability problems.
Example: If I target CSS to FireFox 2 now, the release of FireFox 3 may require that I change/redeploy my code?
Example: If I target CSS to IE as a whole (not to a specific version) because of a particular defect in IE7, what happens if this defect gets resolved with IE8? (This was all too often the case with IE6 and IE7).
Example: Managing separate style sheets for each browser requiring support is a worst case scenario, but *quite* a head-ache
Instead, CSS should be written according to the W3 CSS specifications; either user agents will support a given CSS feature (selector, pseudo-class, etc.) or not.
-Targeting CSS to particular browsers is counter-productive given the goal of standards-compliant CSS and HTML.
-So rather than targeting CSS to a specific web browser, the CSS should be implicitly targeted based on support for a given CSS feature.
Having said that, you might wonder - isn't IE's conditional comment system an example of targeting CSS to a specific user agent?
Well, yes and no.
Yes - conditional comments *do* target CSS specifically to (or from) IE. So, this is a maintainability problem as noted in point B above. However, because of the specific CSS defects caused by IE's lack of support for W3 standards (see: http://www.positioniseverything.net/, http://www.satzansatz.de/cssd/onhavinglayout.html), targeting CSS to this browser is acceptable and IMHO necessary. Most of the other widely used, modern browsers/rendering engines (Gecko, WebCore, Presto) support the CSS specs to a degree that in almost all cases, targeting specific style sheets to these browsers is not necessary.
No - Conditional comments are not like traditional CSS user agent targeting, however, because they do not rely on the user-agent HTTP header. Typically, conditional comments are used to send additional CSS rules to IE to override rules set for all other browsers. Basically, it's kind of like punishing IE for not supporting the CSS standards. This means that we *don't* have to manage separate style sheets for all browsers/versions - just for this versions of IE requiring fixes.
So, Conditional Comments do not have problem A and problem B is an acceptable consequence of the *need* to target CSS to IE.
For these reasons I think that a module in JBoss Portal that targets CSS to user agents is actually (a) over-architecting the solution and (b) leading away from the standards-compliant nature that JBoss Portal should push for. I think supporting conditional comments alone is the right approach for JBoss Portal.
-----
BTW: I'm not a Microsoft/IE basher. IE7 greatly enhanced its standards support for CSS and HTML. The fact is that a lot of folks still use IE6, which has limited support for CSS/HTML standards.
> Allow different stylesheets for different user-agents
> -----------------------------------------------------
>
> Key: JBPORTAL-1631
> URL: http://jira.jboss.com/jira/browse/JBPORTAL-1631
> Project: JBoss Portal
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: Portal Theme
> Reporter: Thomas Heute
> Assigned To: Julien Viet
> Fix For: 2.8 Final
>
>
> It should be possible to define several stylesheets for a theme that would be applied for different user-agents.
> Several stylesheets can be handy to respect the differences between IE versions and also with other browsers.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list