From: Jakub Pawlowicz Date: Sun, 14 Jun 2015 14:41:11 +0000 (+0100) Subject: Fixes #602 - backslash IE hacks after a space. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=3d686586ae2e1b2f373d9dc6bec19fa0f94c1742;p=clean-css.git Fixes #602 - backslash IE hacks after a space. Previously a backslash IE hacks with a leading space were not processed correctly. --- diff --git a/History.md b/History.md index 77f5452c..4962dfa5 100644 --- a/History.md +++ b/History.md @@ -3,6 +3,7 @@ * Fixed issue [#595](https://github.com/jakubpawlowicz/clean-css/issues/595) - more relaxed block matching. * Fixed issue [#601](https://github.com/jakubpawlowicz/clean-css/issues/601) - percentage minifying inside `flex`. +* Fixed issue [#602](https://github.com/jakubpawlowicz/clean-css/issues/602) - backslash IE hacks after a space. [3.3.1 / 2015-06-02](https://github.com/jakubpawlowicz/clean-css/compare/v3.3.0...v3.3.1) ================== diff --git a/lib/selectors/optimization-metadata.js b/lib/selectors/optimization-metadata.js index a0b27a8a..566b9e36 100644 --- a/lib/selectors/optimization-metadata.js +++ b/lib/selectors/optimization-metadata.js @@ -43,6 +43,9 @@ function addToProperty(property) { } else if (lastValue[0].indexOf(BACKSLASH_HACK) > 0 && lastValue[0].indexOf(BACKSLASH_HACK) == lastValue[0].length - BACKSLASH_HACK.length - 1) { lastValue[0] = lastValue[0].substring(0, lastValue[0].length - BACKSLASH_HACK.length - 1); hackType = 'suffix'; + } else if (lastValue[0].indexOf(BACKSLASH_HACK) === 0 && lastValue[0].length == 2) { + property.pop(); + hackType = 'suffix'; } // TODO: this should be done at tokenization step diff --git a/test/fixtures/bootstrap-min.css b/test/fixtures/bootstrap-min.css index fb357e4f..0f2334fa 100644 --- a/test/fixtures/bootstrap-min.css +++ b/test/fixtures/bootstrap-min.css @@ -663,7 +663,7 @@ fieldset{min-width:0;margin:0} legend{display:block;width:100%;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border-bottom:1px solid #e5e5e5} label{display:inline-block;max-width:100%;margin-bottom:5px} input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none} -input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px \9;line-height:normal} +input[type=checkbox],input[type=radio]{margin:4px 0 0;line-height:normal} .form-control,output{display:block;font-size:14px;line-height:1.42857143;color:#555} input[type=file]{display:block} input[type=range]{display:block;width:100%} @@ -686,7 +686,7 @@ textarea.form-control{height:auto} .form-group{margin-bottom:15px} .checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px} .checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer} -.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px \9;margin-left:-20px} +.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-left:-20px} .checkbox+.checkbox,.radio+.radio{margin-top:-5px} .checkbox-inline,.radio-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer} .checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px} diff --git a/test/selectors/optimization-metadata-test.js b/test/selectors/optimization-metadata-test.js index fec289c7..d8936acf 100644 --- a/test/selectors/optimization-metadata-test.js +++ b/test/selectors/optimization-metadata-test.js @@ -60,6 +60,13 @@ vows.describe(addOptimizationMetadata) addOptimizationMetadata(tokens); assert.deepEqual(tokens, [['selector', ['a'], [[['width', false, false], ['0']]] ]]); } + }, + 'backslash hack - space between values123': { + 'topic': [['selector', ['a'], [[['width'], ['0'], ['\\9']]] ]], + 'metadata': function (tokens) { + addOptimizationMetadata(tokens); + assert.deepEqual(tokens, [['selector', ['a'], [[['width', false, 'suffix'], ['0']]] ]]); + } } }) .addBatch({