|
|
 |
Article:
 |
 |
The Vanishing Image: XHTML 2 Migration Issues
|
| Subject: |
Use of Conditional Comments |
| Date: |
2003-07-03 21:30:26 |
| From: |
MikeyC Cacciottolo |
|
|
|
|
Using conditional comments as described in the article will actually hide the nested Object from all browsers:
<!--[if !IE]>
<object></object>
<![endif]-->
Therefore, it should be constructed in the following way in order to hide the nested Object only from Internet Explorer. However, this method won't validate which means it can't be used in XHTML 2.0:
<![if !IE]>
<object></object>
<![endif]>
|
- Use of Conditional Comments
2003-07-04 00:38:36 bryan rasmussen
[Reply]
conditional comments has always seemed sort of an ugly hack to me, although if the focus starts to shift from IE as the development target of choice to IE as a legacy browser then they become perhaps more useful.
- Use of Conditional Comments
2003-07-05 06:58:33 James Fuller
[Reply]
+1 on that, and why build another processing idiom, when we have xslt;
legacy html
<html>
<body>
<img id="1" src="sample.jpg" alt="sample" width="100" height="100" />
</body>
</html>
migration stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="img">
<object id="{@id}"
type="image/jpeg"
data="{@src}"
width="{@width}"
height="{@height}"/>
</xsl:template>
</xsl:stylesheet>
and of course we can build in logic to manipulate as per the "if" statements.
Personally, I see xhtml a perfect partner with xslt, and would like to see increased binding between the two.
cheers, jim fuller
- Use of Conditional Comments
2003-07-04 03:17:18 Florian Bauer
[Reply]
You can embed the conditional comments like this:
<!-- [if !IE] -->
<object></object>
<!-- <![endif] -->
- Use of Conditional Comments
2006-04-09 08:19:33 allthegoodnamesaretaken
[Reply]
I can't comment on xhtml but I've tested all the examples above as plain HTML and they don't work! However there is a syntax for 'down-level' (Microsofts' obnoxious label for browsers that aren't IE) CC's that works AND validates:
<!--[if gte IE 6]><!-->
Seen by all real browsers and IE 6. Validates as HTML 4.01 Transitional and possibly other doctypes
<!--<![endif]-->
Tested and working on Firefox 1.5, Opera 7.5, IE6, Konqueror and Lynx.
The only problem I've found with this code is that it confuses the syntax highlighter built into the CFML module for Eclipse (causing it to render the remaining page in comment green).
Thanks to Stu at cssplay.co.uk for finding this. I don't know where he found it but I'm grateful anyway. As usual the MS documentation was completely useless and even google failed to turn up much of value.
|
 |
Sponsored By:
|