Can you not just add a class to the element in question? If not, how about something like this:
function cloneCSS(source, receiver){
var cssObj = {
position: source.css('position'),
top: source.css('top'),
left: source.css('left'),
height: source.css('height'),
width: source.css('width'),
border-top-width: source.css('border-top-width'),
border-top-width: source.css('border-top-style'),
border-top-width: source.css('border-top-color'),
border-bottom-width: source.css('border-bottom-width'),
border-bottom-width: source.css('border-bottom-style'),
border-bottom-width: source.css('border-bottom-color'),
border-left-width: source.css('border-left-width'),
border-left-width: source.css('border-left-style'),
border-left-width: source.css('border-left-color'),
border-right-width: source.css('border-right-width'),
border-right-width: source.css('border-right-style'),
border-right-width: source.css('border-right-color'),
};
receiver.css(cssObj);
}
Annoying that you have to set all those border properties individually, but that's the way it goes. The good thing about creating an object like this and then applying it in the css()
method is that you only have to call that method once, so you are only modifying the DOM once.