Skip to content

Commit

Permalink
fixed bug with class name not recognising whitespace
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.danwebb.net/external/CodeHighlighter/trunk@134 a686c101-5f17-0410-80e1-b267258107f6
  • Loading branch information
danwebb committed Nov 8, 2006
1 parent 206de3a commit 770caef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code_highlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 770caef

Please sign in to comment.