Index: media.php
===================================================================
--- media.php	(revision 23434)
+++ media.php	(working copy)
@@ -753,7 +753,7 @@
 	$gallery_style = $gallery_div = '';
 	if ( apply_filters( 'use_default_gallery_style', true ) )
 		$gallery_style = "
-		<style type='text/css'>
+		<style type=\"text/css\">
 			#{$selector} {
 				margin: auto;
 			}
@@ -772,21 +772,21 @@
 		</style>
 		<!-- see gallery_shortcode() in wp-includes/media.php -->";
 	$size_class = sanitize_html_class( $size );
-	$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
+	$gallery_div = "<div id=\"$selector\" class=\"gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}\">";
 	$output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
 
 	$i = 0;
 	foreach ( $attachments as $id => $attachment ) {
 		$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
 
-		$output .= "<{$itemtag} class='gallery-item'>";
+		$output .= "<{$itemtag} class=\"gallery-item\">";
 		$output .= "
-			<{$icontag} class='gallery-icon'>
+			<{$icontag} class=\"gallery-icon\">
 				$link
 			</{$icontag}>";
 		if ( $captiontag && trim($attachment->post_excerpt) ) {
 			$output .= "
-				<{$captiontag} class='wp-caption-text gallery-caption'>
+				<{$captiontag} class=\"wp-caption-text gallery-caption\">
 				" . wptexturize($attachment->post_excerpt) . "
 				</{$captiontag}>";
 		}
@@ -796,10 +796,10 @@
 	}
 
 	$output .= "
-			<br style='clear: both;' />
+			<br style=\"clear: both;\" />
 		</div>\n";
 
-	return $output;
+	return apply_filters('gallery_output', $output);
 }
 
 /**
