Index: wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js
===================================================================
--- wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js	(revision 21229)
+++ wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js	(working copy)
@@ -142,13 +142,16 @@
 				var id, cls, w, cap, div_cls, img, trim = tinymce.trim;
 
 				id = b.match(/id=['"]([^'"]*)['"] ?/);
-				b = b.replace(id[0], '');
+				if ( id )
+					b = b.replace(id[0], '');
 
 				cls = b.match(/align=['"]([^'"]*)['"] ?/);
-				b = b.replace(cls[0], '');
+				if ( cls )
+					b = b.replace(cls[0], '');
 
 				w = b.match(/width=['"]([0-9]*)['"] ?/);
-				b = b.replace(w[0], '');
+				if ( w )
+					b = b.replace(w[0], '');
 
 				c = trim(c);
 				img = c.match(/((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)([\s\S]*)/i);
