rem: insertText(text.substr(0, firstMatch.start), containerTag, data); 
add: this.insertPlainText(beforeText, containerTag, data); 
context: function mng_mungePriority(priority, text, containerTag, data){    var matches = new Object();    var entry;    // Find all the matches in this priority    for (entry in this.entries[priority])    {        var munger = this.entries[priority][entry];        if (!munger.enabled)            continue;        var match = null;        if (typeof munger.lambdaMatch == "function")        {            var rval = munger.lambdaMatch(text, containerTag, data, munger);            if (typeof rval == "string")                match = { start: text.indexOf(rval), text: rval };            else if (typeof rval == "object")                match = rval;        }        else        {            var ary = text.match(munger.regex);            if ((ary != null) && (ary[1]))                match = { start: text.indexOf(ary[1]), text: ary[1] };        }        if (match && (match.start >= 0))        {            match.munger = munger;            matches[entry] = match;        }    }    // Find the first matching entry...    var firstMatch = { start: text.length, munger: null };    var firstPriority = 0;    for (entry in matches)    {        // If it matches before the existing first, or at the same spot but        // with a higher start-priority, this is a better match.        if (matches[entry].start < firstMatch.start ||            ((matches[entry].start == firstMatch.start) &&             (this.entries[priority][entry].startPriority > firstPriority)))        {            firstMatch = matches[entry];            firstPriority = this.entries[priority][entry].startPriority;        }    }    // Replace it.    if (firstMatch.munger)    {        var munger = firstMatch.munger;        firstMatch.end = firstMatch.start + firstMatch.text.length;        // Insert the text before the match if there is any        if (firstMatch.start > 0)            insertText(text.substr(0, firstMatch.start), containerTag, data);        if (typeof munger.lambdaReplace == "function")        {            // There is no need to munge the "before" text, as we should            // have found the earliest matching entry by now.            // The munger rule itself should take care of munging the 'inside'            // of the match.            munger.lambdaReplace(firstMatch.text, containerTag, data, munger);            this.munge(text.substr(firstMatch.end), containerTag, data);            return containerTag;        }        else        {            var tag = document.createElementNS(NS_XHTML, munger.tagName);            tag.setAttribute("class", munger.className + calcClass(data));            // Don't let this rule match again when we recurse.            munger.enabled = false;            this.munge(firstMatch.text, tag, data);            munger.enabled = true;            containerTag.appendChild(tag);            this.munge(text.substr(firstMatch.end), containerTag, data);            return containerTag;        }    }    return null;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9421/9f66fbabbdb20ce9c6a9837435ed2d60922ebf14/munger.js/clean/extensions/irc/xul/lib/munger.js