Index: wp-includes/comment-template.php
===================================================================
--- wp-includes/comment-template.php	(revision 22086)
+++ wp-includes/comment-template.php	(working copy)
@@ -1244,11 +1244,11 @@
 			case 'div':
 				break;
 			case 'ol':
-				echo "<ol class='children'>\n";
+				echo '<ol class="children">' . "\n";
 				break;
 			default:
 			case 'ul':
-				echo "<ul class='children'>\n";
+				echo '<ul class="children">' . "\n";
 				break;
 		}
 	}
@@ -1268,11 +1268,11 @@
 			case 'div':
 				break;
 			case 'ol':
-				echo "</ol>\n";
+				echo "</ol><!-- .children -->\n";
 				break;
 			default:
 			case 'ul':
-				echo "</ul>\n";
+				echo "</ul><!-- .children -->\n";
 				break;
 		}
 	}
@@ -1330,50 +1330,73 @@
 		$GLOBALS['comment_depth'] = $depth;
 		$GLOBALS['comment'] = $comment;
 
-		if ( !empty($args['callback']) ) {
-			call_user_func($args['callback'], $comment, $args, $depth);
+		if ( !empty( $args['callback'] ) ) {
+			call_user_func( $args['callback'], $comment, $args, $depth );
 			return;
 		}
 
-		extract($args, EXTR_SKIP);
+		extract( $args, EXTR_SKIP );
 
-		if ( 'div' == $args['style'] ) {
-			$tag = 'div';
-			$add_below = 'comment';
-		} else {
-			$tag = 'li';
-			$add_below = 'div-comment';
-		}
-?>
-		<<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
-		<?php if ( 'div' != $args['style'] ) : ?>
-		<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
-		<?php endif; ?>
-		<div class="comment-author vcard">
-		<?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
-		<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
-		</div>
-<?php if ($comment->comment_approved == '0') : ?>
-		<em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
-		<br />
-<?php endif; ?>
+		$list_tag = ( 'div' == $style ) ? 'div' : 'li';
+		$wrapper_tag = ( 'html5' == strtolower( $markup ) ) ? 'article' : 'div';
 
-		<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
-			<?php
-				/* translators: 1: date, 2: time */
-				printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','' );
-			?>
-		</div>
+		// Display trackbacks differently than normal comments.
+		if ( ( 'pingback' == $comment->comment_type || 'pingback' == $comment->comment_type ) && $short_ping ) : ?>
 
-		<?php comment_text() ?>
+			<<?php echo $list_tag ?> <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
+				<div class="comment-body">
+					<?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)' ), '<span class="edit-link">', '</span>' ); ?>
+				</div>
 
-		<div class="reply">
-		<?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
-		</div>
-		<?php if ( 'div' != $args['style'] ) : ?>
-		</div>
-		<?php endif; ?>
-<?php
+		<?php else : // Proceed with normal comments. ?>
+
+			<<?php echo $list_tag; ?> <?php comment_class( empty( $has_children ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
+				<<?php echo $wrapper_tag; ?> id="div-comment-<?php comment_ID(); ?>" class="comment-body">
+
+					<?php if ( 'html5' == strtolower( $markup ) ) : ?>
+
+					<header class="comment-meta comment-author vcard">
+						<?php if ( 0 < $avatar_size ) echo get_avatar( $comment, $avatar_size ); ?>
+						<?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
+						<?php printf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
+								esc_url( get_comment_link( $comment->comment_ID ) ),
+								get_comment_time( 'c' ),
+								/* translators: 1: date, 2: time */
+								sprintf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() )
+							); ?>
+						<?php edit_comment_link( __( '(Edit)' ), '<span class="edit-link">', '</span>' ); ?>
+					</header><!-- .comment-meta -->
+
+					<?php else : ?>
+
+					<div class="comment-author vcard">
+						<?php if ( 0 < $avatar_size ) echo get_avatar( $comment, $avatar_size ); ?>
+						<?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
+					</div><!-- .comment-author -->
+
+					<div class="comment-meta commentmetadata">
+						<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
+						<?php printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); /* translators: 1: date, 2: time */ ?></a>
+						<?php edit_comment_link( __( '(Edit)' ), '<span class="edit-link">', '</span>' ); ?>
+					</div><!-- .comment-meta -->
+
+					<?php endif; ?>
+
+					<?php if ( '0' == $comment->comment_approved ) : ?>
+					<p class="comment-awaiting-moderation"><em><?php _e( 'Your comment is awaiting moderation.' ); ?></em><p>
+					<?php endif; ?>
+
+					<?php if ( $comment_content_wrapper ) : ?><div class="comment-content"><?php endif; ?>
+						<?php comment_text(); ?>
+					<?php if ( $comment_content_wrapper ) : ?></div><!-- .comment-content --><?php endif; ?>
+
+					<div class="reply">
+						<?php comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $max_depth ) ) ); ?>
+					</div><!-- .reply -->
+
+				</<?php echo $wrapper_tag; ?>><!-- div-comment-## -->
+
+		<?php endif; // end comment_type check
 	}
 
 	/**
@@ -1385,17 +1408,16 @@
 	 * @param int $depth Depth of comment.
 	 * @param array $args
 	 */
-	function end_el(&$output, $comment, $depth = 0, $args = array() ) {
-		if ( !empty($args['end-callback']) ) {
-			call_user_func($args['end-callback'], $comment, $args, $depth);
+	function end_el( &$output, $comment, $depth = 0, $args = array() ) {
+		if ( !empty( $args['end-callback'] ) ) {
+			call_user_func( $args['end-callback'], $comment, $args, $depth );
 			return;
 		}
 		if ( 'div' == $args['style'] )
-			echo "</div>\n";
+			echo "</div><!-- #comment-## -->\n";
 		else
-			echo "</li>\n";
+			echo "</li><!-- #comment-## -->\n";
 	}
-
 }
 
 /**
@@ -1417,8 +1439,9 @@
 	$comment_alt = $comment_thread_alt = 0;
 	$comment_depth = 1;
 
-	$defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
-		'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '');
+	$defaults = array( 'walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
+		'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'short_ping' => false,
+		'markup' => '' );
 
 	$r = wp_parse_args( $args, $defaults );
 
