keithclark/selectivizr — pull request #76 by epicyclist (2013-08-14 17:06:58+00:00)
Title: Whitespace normalization and regex simplification

The RE_COMMENT regex seems unnecessarily complex: I've simplified it.

The whitespace normalization is the focus of this pull request. I'm working with Rails' asset pipeline and I found a peculiarity where one of its resulting CSS assets contains over 5,000 spaces (between two sheets that it pulled together). This is causing selectivizr to hang; I suspect the excessive space may be triggering "catastrophic backtracking." I've wrapped the loaded stylesheet with normalizeWhitespace to prevent this from happening.