JavaScript
function copyStyle(element, clone) {
var attr = ['font-family', 'font-size', 'font-weight', 'font-style', 'color',
'text-transform', 'text-decoration', 'letter-spacing', 'word-spacing',
'line-height', 'text-align', 'vertical-align', 'direction', 'background-color',
'background-image', 'background-repeat', 'background-position',
'background-attachment', 'opacity', 'width', 'height', 'top', 'right', 'bottom',
'left', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left',
'padding-top', 'padding-right', 'padding-bottom', 'padding-left',
'border-top-width', 'border-right-width', 'border-bottom-width',
'border-left-width', 'border-top-color', 'border-right-color',
'border-bottom-color', 'border-left-color', 'border-top-style',
'border-right-style', 'border-bottom-style', 'border-left-style', 'position',
'display', 'visibility', 'z-index', 'overflow-x', 'overflow-y', 'white-space',
'clip', 'float', 'clear', 'cursor', 'list-style-image', 'list-style-position',
'list-style-type', 'marker-offset'];
var len = attr.length, obj = {};
for (var i = 0; i < len; i++) {
clone.css(attr[i], element.css(attr[i]));
}
var ii = clone.children().length;
for (var i = 0; i < ii; i++) {
copyStyle($(element.children()[i]),$( clone.children()[i]));
}
}
var a = $('#originalIFrame').contents().find('.aiButton');
a.each(function () {
var c = $(this).clone();
copyStyle($(this), c);
...