#acronymizer.js
Wraps text in HTML with an element (acron by default) whilst keeping any bound events intact.
https://github.com/xurion/acronymizer.js
var div = document.getElementById('myDiv'),
acron = new Acronymizer({
element: div,
pattern: 'CSS'
});
acron.init();
var div = document.getElementById('myDiv'),
acron = new Acronymizer();
acron.setElement(div);
acron.setPattern('PHP');
acron.setWrapper('a');
acron.setAttribute('href', 'php.html');
acron.init();
To use acronymizer.js, simply add it to your markup:
<script type="text/javascript" src="acronymizer/dist/acronymizer.min.js"></script>
To have acronymizer ignore elements, simply apply the "acronymizer-skip" class to that element. That element, as well as all nested elements, will be skipped.
acronymizer.js initially started it's life as an easy way to wrap text patterns in markup with acron elements. This allowed me to acronym abbreviations, like CSS and PHP and provide a tooltip as you hovered over it.
It has since been modified to be a JSHint-covered, tested class to allow the wrapping of any pattern with any element, along with any attributes.