Forum Moderators: not2easy

Message Too Old, No Replies

doctype and css expression

         

hbmehta

7:09 pm on May 6, 2010 (gmt 0)

10+ Year Member



I am using transitional doctype - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

with that if I use any css expression, it doesnt work for eg. - background-color:expression(rowIndex%2?("#d9e3f0"||"#c9d7e9"):"");

If I remove doctype it works perfectly but I have to use doctype. So any solution for - using doctype and expressions both at the same time?

Thanks in advance and please provide some solution or work around for this scenario.

rainborick

2:34 pm on May 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



CSS Expressions are only supported by Internet Explorer in Quirks Mode. So when you have a complete <!DOCTYPE> statement, IE is in Standards Compliance mode and they are disabled. Since CSS Expressions are being depreciated by Microsoft, and no other browsers support it at all, you'll be best off handling this setting in JavaScript.

hbmehta

4:32 pm on May 12, 2010 (gmt 0)

10+ Year Member



Hey Thanks for the reply. I got your point but using javascript will decrease the performance. I am doing that only, until IE supports all those first-child and nth-child properties I cant think of any other way.

rainborick

4:52 pm on May 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'd still recommend JavaScript. As I say, CSS Expressions are only supported by MSIE and so a good proportion of your users will never see your enhancements. Further, if your pages are rendered in Quirks Mode, you'll have to keep the design pretty simply to have them be presentable in other browsers. With MSIE's market share now below 70%, that's a lot of people you won't be well-serving.

JavaScript runs very fast these days, so I doubt you'd see a significant performance issue versus CSS Expressions, if any, and you'd gain full cross-browser compatibility. It seems to me that's a pretty fair trade.