I found this wonderful script on StackOverflow, which returns the code for any DOM element with all styles intact: https://stackoverflow.com/a/6310120/3001859
The only problem with it is, (it looks like) it doesn't compute and return the styles for the original element. It only does it for the inner elements. How can I modify this - so it returns the complete code, with the styles for the original element too?
(I cannot comment on the original thread coz of my low rep)