Index: src/wp-includes/media.php
===================================================================
--- src/wp-includes/media.php	(revision 27366)
+++ src/wp-includes/media.php	(working copy)
@@ -701,8 +701,9 @@
 	 * @param string $content The image element, possibly wrapped in a hyperlink.
 	 */
 	$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
-	if ( $output != '' )
+	if ( '' != $output ) {
 		return $output;
+	}
 
 	$atts = shortcode_atts( array(
 		'id'	  => '',
@@ -712,37 +713,48 @@
 	), $attr, 'caption' );
 
 	$atts['width'] = (int) $atts['width'];
-	if ( $atts['width'] < 1 || empty( $atts['caption'] ) )
+	if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) {
 		return $content;
+	}
 
-	if ( ! empty( $atts['id'] ) )
+	if ( ! empty( $atts['id'] ) ) {
 		$atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" ';
+	}
 
-	$caption_width = 10 + $atts['width'];
+	if ( current_theme_supports( 'html5', 'caption' ) ) {
+		$output = '<figure ' . $atts['id'] . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">'
+		. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
 
-	/**
-	 * Filter the width of an image's caption.
-	 *
-	 * By default, the caption is 10 pixels greater than the width of the image,
-	 * to prevent post content from running up against a floated image.
-	 *
-	 * @since 3.7.0
-	 *
-	 * @see img_caption_shortcode()
-	 *
-	 * @param int    $caption_width Width of the caption in pixels. To remove this inline style,
-	 *                              return zero.
-	 * @param array  $atts          Attributes of the caption shortcode.
-	 * @param string $content       The image element, possibly wrapped in a hyperlink.
-	 */
-	$caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content );
+	} else {
+		$caption_width = 10 + $atts['width'];
 
-	$style = '';
-	if ( $caption_width )
-		$style = 'style="width: ' . (int) $caption_width . 'px" ';
+		/**
+		 * Filter the width of an image's caption.
+		 *
+		 * By default, the caption is 10 pixels greater than the width of the image,
+		 * to prevent post content from running up against a floated image.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @see img_caption_shortcode()
+		 *
+		 * @param int    $caption_width Width of the caption in pixels. To remove this inline style,
+		 *                              return zero.
+		 * @param array  $atts          Attributes of the caption shortcode.
+		 * @param string $content       The image element, possibly wrapped in a hyperlink.
+		 */
+		$caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content );
 
-	return '<div ' . $atts['id'] . $style . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">'
-	. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
+		$style = '';
+		if ( $caption_width ) {
+			$style = 'style="width: ' . (int) $caption_width . 'px" ';
+		}
+
+		$output = '<div ' . $atts['id'] . $style . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">'
+		. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
+	}
+
+	return $output;
 }
 
 add_shortcode('gallery', 'gallery_shortcode');
