I would like to retrieve a certain tag element with its attributes from the DOM. For example, from
link text
If someone is not using jQuery . . .
elem.outerHTML
"
link text
"
elem.cloneNode().outerHTML
""
If you want to be safe for Firefox etc. released before mid-2014, use cloneNode(false) to avoid getting inner stuff.
Reference: https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode