From: Michael M Slusarz Date: Mon, 10 Aug 2009 05:17:14 +0000 (-0600) Subject: Support IE conditional comments X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5bb7056368b316547a5a8c9067ffa18ad7626a3b;p=horde.git Support IE conditional comments --- diff --git a/framework/Text_Filter/lib/Horde/Text/Filter/JavascriptMinify/JsMin.php b/framework/Text_Filter/lib/Horde/Text/Filter/JavascriptMinify/JsMin.php index 8539efce0..7b5333eeb 100644 --- a/framework/Text_Filter/lib/Horde/Text/Filter/JavascriptMinify/JsMin.php +++ b/framework/Text_Filter/lib/Horde/Text/Filter/JavascriptMinify/JsMin.php @@ -185,6 +185,7 @@ class Horde_Text_Filter_JavascriptMinify_JsMin protected function _next() { + $c = $this->_get(); if ($c !== '/') { @@ -193,21 +194,37 @@ class Horde_Text_Filter_JavascriptMinify_JsMin switch ($this->_peek()) { case '/': + $comment = ''; + while (true) { $c = $this->_get(); + $comment .= $c; if (ord($c) <= self::ORD_LF) { + // IE conditional comment + if (preg_match('/^\\/@(?:cc_on|if|elif|else|end)\\b/', $comment)) { + return '/' . $comment; + } + return $c; } } case '*': + $comment = ''; $this->_get(); while (true) { - switch($this->_get()) { + $get = $this->_get(); + switch ($get) { case '*': if ($this->_peek() === '/') { $this->_get(); + + // IE conditional comment + if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) { + return '/*' . $comment . '*/'; + } + return ' '; } break; @@ -215,6 +232,8 @@ class Horde_Text_Filter_JavascriptMinify_JsMin case null: throw new Exception('Unterminated comment.'); } + + $comment .= $get; } }