mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
22 lines
530 B
JavaScript
22 lines
530 B
JavaScript
|
const dccInputFactory = ( original ) => {
|
||
|
const styles = window.getComputedStyle( original );
|
||
|
const newElement = document.createElement( 'span' );
|
||
|
|
||
|
newElement.setAttribute( 'id', original.id );
|
||
|
newElement.setAttribute( 'class', original.className );
|
||
|
|
||
|
Object.values( styles ).forEach( ( prop ) => {
|
||
|
if (
|
||
|
! styles[ prop ] ||
|
||
|
! isNaN( prop ) ||
|
||
|
prop === 'background-image'
|
||
|
) {
|
||
|
return;
|
||
|
}
|
||
|
newElement.style.setProperty( prop, '' + styles[ prop ] );
|
||
|
} );
|
||
|
return newElement;
|
||
|
};
|
||
|
|
||
|
export default dccInputFactory;
|