diff options
author | Michael Dodge <mgdodge@gmail.com> | 2013-01-05 07:22:51 +0100 |
---|---|---|
committer | Michael Dodge <mgdodge@gmail.com> | 2013-01-05 07:22:51 +0100 |
commit | 4d02e356cadd9af49c915c76b7cd27d01e67edb8 (patch) | |
tree | f26a8a4e6de346d0c9a48dd8352f41bfa046f334 | |
parent | 362b80054ed80940064fd7891a9628279498504b (diff) |
Fix MSIE conditionals regex in minify output
Allows IE conditionals like the following to remain unmodified.
```html
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
```
Credit to joebert regex from
http://www.sitepoint.com/forums/showthread.php?696559-Regex-pattern-to-strip-HTML-comments-but-leave-conditonals&s=3eef4ceb0a59b2fdb946fa56220fb6fd&p=4678083&viewfull=1#post4678083
-rw-r--r-- | system/core/Output.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/system/core/Output.php b/system/core/Output.php index ce0500e71..27e711783 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -739,7 +739,7 @@ class CI_Output { $output = preg_replace('!\s{2,}!', ' ', $output); // Remove comments (non-MSIE conditionals) - $output = preg_replace('{\s*<!--[^\[].*-->\s*}msU', '', $output); + $output = preg_replace('{\s*<!--[^\[<>].*(?<!!)-->\s*}msU', '', $output); // Remove spaces around block-level elements. $output = preg_replace('/\s*(<\/?(html|head|title|meta|script|link|style|body|h[1-6]|div|p|br)[^>]*>)\s*/is', '$1', $output); |