From: Jakub Pawlowicz Date: Fri, 23 Jan 2015 22:55:39 +0000 (+0000) Subject: Fixes #445 - speed issue in url processor. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=03ae69d3f3ef37ae9e1f003843e9ba2ef2b4079d;p=clean-css.git Fixes #445 - speed issue in url processor. Obviously we don't need to search for uppercase URLs constantly, just if there is at least one. --- diff --git a/History.md b/History.md index 2fea22f6..e5a26352 100644 --- a/History.md +++ b/History.md @@ -11,6 +11,7 @@ * Fixed issue [#435](https://github.com/GoalSmashers/clean-css/issues/435) - `background-clip` in shorthand. * Fixed issue [#439](https://github.com/GoalSmashers/clean-css/issues/439) - `background-origin` in shorthand. * Fixed issue [#442](https://github.com/GoalSmashers/clean-css/issues/442) - space before adjacent `nav`. +* Fixed issue [#445](https://github.com/GoalSmashers/clean-css/issues/445) - regression issue in url processor. [3.0.7 / 2015-01-22](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.6...v3.0.7) ================== diff --git a/lib/text/urls-processor.js b/lib/text/urls-processor.js index c5f47344..23993880 100644 --- a/lib/text/urls-processor.js +++ b/lib/text/urls-processor.js @@ -25,10 +25,11 @@ UrlsProcessor.prototype.escape = function (data) { var lastBreakAt; var indent; var saveWaypoints = this.saveWaypoints; + var hasUppercaseUrl = data.indexOf(UPPERCASE_URL_PREFIX) > -1; for (; nextEnd < data.length;) { nextStart = data.indexOf(URL_PREFIX, nextEnd); - nextStartUpperCase = data.indexOf(UPPERCASE_URL_PREFIX, nextEnd); + nextStartUpperCase = hasUppercaseUrl ? data.indexOf(UPPERCASE_URL_PREFIX, nextEnd) : -1; if (nextStart == -1 && nextStartUpperCase == -1) break;