Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var fullreset = (function () {
$(function () {
var iframe = document.createElement("iframe");
$("body").append(iframe);
var doc = iframe.contentDocument;
var win = iframe.contentWindow;
doc.open();
var html = "<!DOCTYPE html>\n"+
"<html><body><p>Not Red</p></body></html>";
doc.write(html);
doc.close();
var p = doc.getElementsByTagName("p")[0];
var curCSS = win.getComputedStyle(p, null)
var text = "#reset p {\n";
for(var i = 0; i < curCSS.length; i++) {
var name = curCSS[i];
text += name+": "+curCSS.getPropertyValue(name)+";\n"
}
text += "}\n"
$("body").append("<pre>"+text+"</pre>");
$("body").append('<style type="text/css">'+text+'</style>')
});
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.