Fixes #246 - removes IE hacks when not in compatibility mode.
authorJakub Pawlowicz <jakub@goalsmashers.com>
Tue, 3 Jun 2014 22:02:38 +0000 (23:02 +0100)
committerJakub Pawlowicz <jakub@goalsmashers.com>
Tue, 3 Jun 2014 22:03:44 +0000 (23:03 +0100)
History.md
lib/clean.js
test/data/big-min.css
test/unit-test.js

index 475f62b..90d744d 100644 (file)
@@ -11,6 +11,7 @@
 * Fixed issue [#184](https://github.com/GoalSmashers/clean-css/issues/184) - uses `!important` for optimization opportunities.
 * Fixed issue [#190](https://github.com/GoalSmashers/clean-css/issues/190) - uses shorthand to override another shorthand.
 * Fixed issue [#197](https://github.com/GoalSmashers/clean-css/issues/197) - adds borders merging by understandability.
+* Fixed issue [#246](https://github.com/GoalSmashers/clean-css/issues/246) - removes IE hacks when not in compatibility mode.
 * Fixed issue [#247](https://github.com/GoalSmashers/clean-css/issues/247) - removes deprecated `selectorsMergeMode` switch.
 * Refixed issue [#250](https://github.com/GoalSmashers/clean-css/issues/250) - based on new quotation marks removal.
 * Fixed issue [#257](https://github.com/GoalSmashers/clean-css/issues/257) - turns hsla/rgba to transparent if possible.
index 982870f..f0a706d 100644 (file)
@@ -327,6 +327,10 @@ var minify = function(data, callback) {
   // remove space after (rgba|hsla) declaration - see #165
   replace(/(rgba|hsla)\(([^\)]+)\) /g, '$1($2)');
 
+  // get rid of IE hacks if not in compatibility mode
+  if (!options.compatibility)
+    replace(/([;\{])[\*_][\w\-]+:[^;\}]+/g, '$1');
+
   if (options.noAdvanced) {
     if (options.keepBreaks)
       replace(/\}/g, '}' + lineBreak);
index 6666340..45774d6 100644 (file)
@@ -1,6 +1,6 @@
 /*! normalize.css 2012-01-31T16:06 UTC - http://github.com/necolas/normalize.css */
 article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}
-audio,canvas,video{display:inline-block;*display:inline;*zoom:1}
+audio,canvas,video{display:inline-block}
 [hidden],audio:not([controls]){display:none}
 html{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}
 button,html,input,select,textarea{font-family:sans-serif}
@@ -14,7 +14,7 @@ b,strong{font-weight:700}
 blockquote{margin:1em 40px}
 dfn{font-style:italic}
 mark{background:#ff0;color:#000}
-code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}
+code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}
 pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}
 q{quotes:none}
 q:after,q:before{content:'';content:none}
@@ -29,12 +29,12 @@ img{-ms-interpolation-mode:bicubic}
 svg:not(:root){overflow:hidden}
 figure,form{margin:0}
 fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
-legend{border:0;padding:0;white-space:normal;*margin-left:-7px}
-button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}
+legend{border:0;padding:0;white-space:normal}
+button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline}
 button,input{line-height:normal}
-button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button;*overflow:visible}
+button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button}
 button[disabled],input[disabled]{cursor:default}
-input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0;*height:13px;*width:13px}
+input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}
 input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
 input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}
 button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
@@ -267,7 +267,6 @@ img[width="202"]{margin-bottom:4px}
 .btn_abo:active{background-color:#ffc600}
 input.btn,input.btn_abo,input.btn_fonce,input.btn_petit{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}
 button::-moz-focus-inner,input[type=submit]::-moz-focus-inner{padding:0;border:0}
-input[type=submit].btn_petit{*padding-top:3px;*padding-bottom:3px}
 .bt_abo{display:inline-block;padding:3px 12px;background:#ffd500;font-weight:700;color:#650}
 .bt_abo:hover{background:#ffc600;color:#000;font-weight:700;cursor:pointer;text-decoration:none}
 .titre_bt_fleche{display:inline-block;overflow:hidden;background:#f5f8f9}
index ef8b219..52b89b1 100644 (file)
@@ -326,7 +326,7 @@ vows.describe('clean-units').addBatch({
     'empty': 'a{color:expression()}',
     'method call': 'a{color:expression(this.parentNode.currentStyle.color)}',
     'multiple call': 'a{color:expression(x = 0 , this.parentNode.currentStyle.color)}',
-    'mixed content': "a{*zoom:expression(this.runtimeStyle[\"zoom\"] = '1', this.innerHTML = '&#xf187;')}",
+    'mixed content': "a{zoom:expression(this.runtimeStyle[\"zoom\"] = '1', this.innerHTML = '&#xf187;')}",
     'in comment': "/*! expression(this.runtimeStyle['zoom']) */",
     'complex': 'a{width:expression((this.parentNode.innerWidth + this.parentNode.innerHeight) / 2 )}',
     'with parentheses': "a{width:expression(this.parentNode.innerText == ')' ? '5px' : '10px' )}",
@@ -960,8 +960,22 @@ path")}',
     'keeps hsla(120,100%,50%,0)': 'a{color:hsla(120,100%,50%,0)}'
   }, { compatibility: 'ie8' }),
   'IE hacks without IE compatibility': cssContext({
-    'star': 'a{*color:#fff}', // See #246
-    'unserscore': 'a{_color:#fff}', // See #246
+    'star': [
+      'a{*color:#fff}',
+      ''
+    ],
+    'unserscore': [
+      'a{_color:#fff}',
+      ''
+    ],
+    'two in a row': [
+      'a{padding:0;*height:13px;*width:13px}',
+      'a{padding:0}'
+    ],
+    'two in a row mixed': [
+      'a{padding:0;*height:13px;_width:13px}',
+      'a{padding:0}'
+    ],
     'backslash': [
       'a{color:#fff\\9}',
       ''