How about createElement() ?
var el = document.createElement("test"); el.style.backgroundColor = "red"; document.body.appendChild(el);
change
If we start with:
<html> <head></head> <body> </body> </html>
The result will be:
<html> <head></head> <body> <test style="background-color:red"></test> </body> </html>
source share