[Seaside] conditionally change the class of the html document for IE

Paul DeBruicker pdebruic at gmail.com
Wed Dec 28 17:51:16 UTC 2011


On 11-12-27 09:56 AM, Philippe Marschall wrote:
>> >  <!DOCTYPE html>
>> >  <!--[if lt IE 7 ]><html class="ie ie6" lang="en">  <![endif]-->
>> >  <!--[if IE 7 ]><html class="ie ie7" lang="en">  <![endif]-->
>> >  <!--[if IE 8 ]><html class="ie ie8" lang="en">  <![endif]-->
>> >  <!--[if (gte IE 9)|!(IE)]><!--><html lang="en">  <!--<![endif]-->
>> >  <head>
> That's a bit tricky. A possible way may be to create a custom
> WAHtmlElement (bad class name BTW) subclass, override #encodeOn: and
> then output the string above. And then maybe a convenience method on
> WAHtmlRoot to add it (see #meta).
>
> Cheers
> Philippe


Thanks for pointing me in the right direction.  The reason why the 
designers conditionally add classes to the <html> tag is described here:

http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/


I ended up overriding

WAHtmlRoot>>#writeHeadOn: to use my own class to add the <html> tag for 
the document if, in my #updateRoot: method I say

aRoot useIEConditionalHtmlElement.

my class just builds the conditional tags and concatenates the 
htmlAttributes from Seaside into each tag then gives that string to 
WAHtmlDocument to put in the right place.  It seems to work OK.





More information about the seaside mailing list