Hi Ty,

It must've come from that article, it looks vaguely familiar.
Personally I saw it as a furtherance to the hasJS technique.
My perspective was to remove separate style sheets, and obscure hacks, purely 
to simplify editing exactly as Paul Irish's article states.
Without using * html and *+html which obfuscates the meaning in the style sheet.

Since querying here I've had difficulty validating code with a class on the 
html element.
Am I incorrect in the belief that it should actually be valid?


Mike

From: li...@webstandardsgroup.org [mailto:li...@webstandardsgroup.org] On 
Behalf Of Ty Hatch
Sent: 28 October 2010 16:15
To: wsg@webstandardsgroup.org
Subject: Re: [WSG] A simple IE and JS detection method?

Take it you pulled this from HTML5 Boilerplate's latest update. Reading through 
Paul Irish's comments on the update 
(http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/)
 the change makes sense.
On Thu, Oct 28, 2010 at 7:21 AM, Foskett, Mike 
<mike.fosk...@uk.tesco.com<mailto:mike.fosk...@uk.tesco.com>> wrote:

Hi All,

I was wondering if you had a little time to comment on the following technique?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<!--[if IE]>
  <![if gt IE 8]><html lang="en-gb" class="gtIE8" xml:lang="en-gb" 
xmlns="http://www.w3.org/1999/xhtml";><![endif]>
  <![if IE 8]><html lang="en-gb" class="IE8" xml:lang="en-gb" 
xmlns="http://www.w3.org/1999/xhtml";><![endif]>
  <![if IE 7]><html lang="en-gb" class="IE7" xml:lang="en-gb" 
xmlns="http://www.w3.org/1999/xhtml";><![endif]>
  <![if IE 6]><html lang="en-gb" class="IE6" xml:lang="en-gb" 
xmlns="http://www.w3.org/1999/xhtml";><![endif]>
<![endif]-->
<!--[if !IE]><!--><html lang="en-gb" class="xIE" xml:lang="en-gb" 
xmlns="http://www.w3.org/1999/xhtml";><!--<![endif]-->
     <script 
type="text/javascript">/*<![CDATA[*/document.documentElement.className+=" 
hasJS";/*]]>*/</script>

... yada ...

<style type="text/css">
body {background:#ccc; color:#000}
.IE8 body {background:#fcc;}
.IE7 body {background:#cfc;}
.IE6 body {background:#ccf;}
.xIE body {background:#fff;}
</style>

... yada ...


Not thoroughly tested I admit but it appears reasonable.
The only failure I can see is detecting IEv6 and JS on because:

                .IE6.hasJS {background:#f000}

will not work as IE 6 cannot concatenate class names.

What do you think?



Regards,

Mike Foskett
http://websemantics.co.uk/



________________________________
This is a confidential email. Tesco may monitor and record all emails. The 
views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8 9SL
VAT Registration Number: GB 220 4302 31

*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org<mailto:memberh...@webstandardsgroup.org>
*******************************************************************


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************

Reply via email to