Created
September 7, 2010 11:51
-
-
Save rmehner/568212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Kill all style Attributes</title> | |
</head> | |
<body style="color: red;"> | |
<p style="border: 2px solid black;"> | |
Foo | |
</p> | |
</body> | |
<script> | |
// works on FF 3.5, Webkit and IE 8 (no idea if it's also working for IE < 8) | |
for (var i = 0, elements = document.querySelectorAll('[style]'); i < elements.length; i++) { | |
elements.item(i).removeAttribute('style'); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment