I could argue that your specific requirement to change attribute names is somewhat unusual, so a somewhat unorthodox solution in the form of a jQuery plug-in might work for you:
$.fn.renameAttrs = function() {
var oldName = arguments[0] + '-',
newName = arguments[1] + '-';
return this.each(function() {
var $node = $(this),
attrs = [];
$.each(this.attributes, function() {
var index = this.name.indexOf(oldName);
if (!index) {
$node.attr(newName + this.name.substr(oldName.length), this.value);
attrs.push(this);
}
});
$.each(attrs, function() {
$node.removeAttr(this.name);
});
});
};