keithclark / selectivizr

selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8.
1.71k stars 247 forks source link

Whitespace normalization and regex simplification #76

Open chris-canipe opened 11 years ago

chris-canipe commented 11 years ago

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.

corysimmons commented 8 years ago

@keithclark disappeared so I'm going to try and maintain this project at https://github.com/corysimmons/selectivizr2

Would you please reopen/rebase your PR over there?