Move _remove_evil_attributes() call
diff --git a/system/core/Security.php b/system/core/Security.php
index ade7749..dd3b2c8 100644
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -480,12 +480,8 @@
 			}
 		}
 		while ($original !== $str);
-
 		unset($original);
 
-		// Remove evil attributes such as style, onclick and xmlns
-		$str = $this->_remove_evil_attributes($str, $is_image);
-
 		/*
 		 * Sanitize naughty HTML elements
 		 *
@@ -518,6 +514,9 @@
 		while ($old_str !== $str);
 		unset($old_str);
 
+		// Remove evil attributes such as style, onclick and xmlns
+		$str = $this->_remove_evil_attributes($str, $is_image);
+
 		/*
 		 * Sanitize naughty scripting elements
 		 *