4 * Enables Internet Explorer style conditional comments to survive XML
5 * parsing by implementing a custom xc:ie-condition attribute to attach
8 class XHTMLCompiler_DOMFilter_IEConditionalComments
extends XHTMLCompiler_DOMFilter
11 protected $name = 'IEConditionalComments';
12 protected $xcAttr = array('ie-condition');
14 public function process(DOMDocument
$dom, $page, $manager) {
16 $nodes = $this->query( "//*[@xc:ie-condition]" );
18 foreach ($nodes as $node) {
19 $condition = $this->confiscateAttr($node, $this->ns
, 'ie-condition');
21 $sxml = simplexml_import_dom($node);
22 $code = $sxml->asXml();
23 $comment = "[if $condition]>$code<![endif]";
24 $parent = $node->parentNode
;
25 $parent->replaceChild($dom->createComment($comment), $node);