bartaz/sandbox.js — pull request #4 by simeonwillbanks (2011-12-16 18:38:00+00:00)
Title: Text can be highlighted without a className

Hello,

Thanks for the plugin; we really appreciate your hard work.

In our use case, we don't need the highlighted text's parent tag to have a className. Here is the API we introduced:

// wrap every occurrance of term 'ipsum' in content
// with
$('#content').highlight('ipsum', { element: 'em', className: false });

Also, I refactored the highlight function to not set a default className. It seemed redundant since the settings variable handles all defaults.

Hope you find this code useful and thanks again,
Simeon