I am facing a requirement where I need to send a table (UI) via email. I attempted to retrieve the native HTML DOM element by using document.querySelector('table'), but it appeared without styles. As a result, the email does not resemble the UI as intended. To try and resolve this issue, I used window.getComputedStyle(document.querySelector('table')) to obtain the computed styles for the 'table'.
Below is an outline of my current situation:
var obj={}; // Object to be sent with REST API, obj.to="[email protected]"; // Recipient obj.body=document.querySelector('table'); // Provides the native DOM HTML code without any styles. However, I require the HTML code with its corresponding styles.
I understand that executing getComputedStyle will retrieve the current styles, but I am uncertain how to merge both elements in order to return the entire content (HTML code and styles) as a string. Your assistance on this matter would be highly appreciated.
This application is built on angularjs 1.4.