From: Jakub Pawlowicz Date: Thu, 5 Mar 2015 06:54:40 +0000 (+0000) Subject: Fixes #480 - uppercase properties in reordering. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=bc51e2a5feb29611fa6d07dc04e1f23104ffed61;p=clean-css.git Fixes #480 - uppercase properties in reordering. It's an edge case but we should support it nonetheless. --- diff --git a/History.md b/History.md index b8de1eb9..ec4ce370 100644 --- a/History.md +++ b/History.md @@ -2,6 +2,7 @@ ================== * Fixed issue [#396](https://github.com/jakubpawlowicz/clean-css/issues/396) - better input source maps tracking. +* Fixed issue [#480](https://github.com/jakubpawlowicz/clean-css/issues/480) - extracting upcase property names. [3.1.4 / 2015-03-04](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.3...v3.1.4) ================== diff --git a/lib/properties/extractor.js b/lib/properties/extractor.js index c675efe9..69156c37 100644 --- a/lib/properties/extractor.js +++ b/lib/properties/extractor.js @@ -47,7 +47,7 @@ function findNameRoot(name) { if (name.indexOf('text-') === 0) return name; - return name.replace(/^\-\w+\-/, '').match(/([a-z]+)/)[0]; + return name.replace(/^\-\w+\-/, '').match(/([a-zA-Z]+)/)[0].toLowerCase(); } module.exports = extract; diff --git a/test/properties/reorderable-test.js b/test/properties/reorderable-test.js index 4450b250..56dde865 100644 --- a/test/properties/reorderable-test.js +++ b/test/properties/reorderable-test.js @@ -53,10 +53,18 @@ vows.describe(canReorderSingle) 'topic': canReorderSingle(propertiesIn('a{color:red}')[0], propertiesIn('a{color:red}')[0]), 'must be true': function (result) { assert.isTrue(result); } }, + 'same properties with same value and different case': { + 'topic': canReorderSingle(propertiesIn('a{COLOR:red}')[0], propertiesIn('a{color:red}')[0]), + 'must be true': function (result) { assert.isTrue(result); } + }, 'same properties with different value': { 'topic': canReorderSingle(propertiesIn('a{color:red}')[0], propertiesIn('a{color:blue}')[0]), 'must be false': function (result) { assert.isFalse(result); } }, + 'same properties with different value and different case': { + 'topic': canReorderSingle(propertiesIn('a{color:red}')[0], propertiesIn('a{COLOR:blue}')[0]), + 'must be false': function (result) { assert.isFalse(result); } + }, 'different properties with same root': { 'topic': canReorderSingle(propertiesIn('a{text-shadow:none}')[0], propertiesIn('a{text-decoration:underline}')[0]), 'must be true': function (result) { assert.isTrue(result); }