From 6b3ae057c48e938434aa29011c42016f5811f7d1 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 11 Jun 2014 22:04:26 +0100 Subject: [PATCH] Fixes #276 - unicode content mistakenly taken as IE hacks. --- History.md | 1 + lib/properties/optimizer.js | 2 +- test/unit-test.js | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/History.md b/History.md index 34a42bfa..b7bcc35a 100644 --- a/History.md +++ b/History.md @@ -22,6 +22,7 @@ * Fixed issue [#257](https://github.com/GoalSmashers/clean-css/issues/257) - turns hsla/rgba to transparent if possible. * Fixed issue [#265](https://github.com/GoalSmashers/clean-css/issues/265) - adds support for multiple input files. * Fixed issue [#275](https://github.com/GoalSmashers/clean-css/issues/275) - handling transform properties. +* Fixed issue [#276](https://github.com/GoalSmashers/clean-css/issues/276) - corrects unicode handling. * Fixed issue [#288](https://github.com/GoalSmashers/clean-css/issues/288) - adds smarter expression parsing. * Fixed issue [#293](https://github.com/GoalSmashers/clean-css/issues/293) - handles escaped @ symbols in classnames and ids. diff --git a/lib/properties/optimizer.js b/lib/properties/optimizer.js index c4533e9d..ce900852 100644 --- a/lib/properties/optimizer.js +++ b/lib/properties/optimizer.js @@ -133,7 +133,7 @@ module.exports = function Optimizer(compatibility, aggressiveMerging) { token.substring(0, firstColon), token.substring(firstColon + 1), token.indexOf('!important') > -1, - token.indexOf(IE_BACKSLASH_HACK, firstColon + 1) > 0 + token.indexOf(IE_BACKSLASH_HACK, firstColon + 1) === token.length - IE_BACKSLASH_HACK.length ]); } diff --git a/test/unit-test.js b/test/unit-test.js index 2da2e4eb..00d4e126 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -806,6 +806,9 @@ vows.describe('clean-units').addBatch({ ], 'font weight in extended font declarations': 'font:normal normal normal 13px/20px Helvetica' }), + 'unicode': cssContext({ + 'font-names': 'body{font-family:\\5FAE\\8F6F\\96C5\\9ED1,\\5B8B\\4F53,sans-serif}' + }), 'urls': cssContext({ 'keep urls without parentheses unchanged': 'a{background:url(/images/blank.png) 0 0 no-repeat}', 'keep non-encoded data URI unchanged': ".icon-logo{background-image:url('data:image/svg+xml;charset=US-ASCII')}", -- 2.34.1