Originally Posted by felgall
It only fails if you use hyphens in your class names.
Anyway if you insist on using hyphens in class names then you could replace the '\\b'+cl+'\\b' in the regexp with '(^| )'+cl+'( |$)' ....
my point was that if good coders like you can make mistakes, what else is missing, how much can we rely on such a function, and do we really NEED to hinge our entire operation on such a contraption.
there are other conformance and performance issues with the script, i'm not going to nit pick.
We collectively built a decent one a while back: http://www.codingforums.com/showthread.php?t=154727
even still, i think that avoiding loops is always good, avoiding hidden snags is always good, and that CSS offers more precise group definition since its CSS selectors work in IE7 without a bunch of bring-your-own code.
BROWSER STATS [% share]
(2013/10/31) IE7:0.5, IE8:8.6, IE9:5.3, IE10:12.3, FF:17.7, CH:41.8, SF:8.1, MOBILE:20.4