Skip to content
Browse files

fixed bug with class name not recognising whitespace

git-svn-id: http://svn.danwebb.net/external/CodeHighlighter/trunk@134 a686c101-5f17-0410-80e1-b267258107f6
  • Loading branch information...
1 parent 206de3a commit 770caef9a7a77eae247dbf48ac6324bf1ebc82d3 danwebb committed Nov 8, 2006
Showing with 2 additions and 2 deletions.
  1. +2 −2 code_highlighter.js
View
4 code_highlighter.js
@@ -148,11 +148,11 @@ CodeHighlighter.init = function() {
function highlightCode(styleSet) {
// clear rules array
- var parsed;
+ var parsed, clsRx = new RegExp("(\\s|^)" + styleSet.name + "(\\s|$)");
rules.length = 0;
// get stylable elements by filtering out all code elements without the correct className
- var stylableEls = codeEls.filter(function(item) {return (item.className.indexOf(styleSet.name)>=0)});
+ var stylableEls = codeEls.filter(function(item) { return clsRx.test(item.className) });
// add style rules to parser
for (var className in styleSet.rules) addRule(className, styleSet.rules[className]);

0 comments on commit 770caef

Please sign in to comment.
Something went wrong with that request. Please try again.